Hi all, is there any example of the melee attack from a mathematical point, without using of Physics engine, etc.
Thank you.
Upd added the project.
At the moment, that's such nonsense. Prompt how to better implement the melee attack.
Ps, a lot of code collected from various sources something himself already did. I'm just starting to learn Lua.
Help with melee attacks
Help with melee attacks
Last edited by slavian on Sat Apr 18, 2015 6:44 pm, edited 1 time in total.
Re: Help with melee attacks
We'll need a bit more of your code to help you with that
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Help with melee attacks
Use AdvTiled to create the world
Showed pieces of code responsible for creating the character and check on touch
Code: Select all
function game.load()
tileSize = 32 -
loadMap(1, 15, 8)
end
function loadMap(level, ox, oy)
map = loader.load("map_"..level..".tmx")
mapw = map.width*tileSize-800
maph = map.height*tileSize-600
createPlayer(ox,oy)
end
function exec( s )
return loadstring( 'return ' .. s )()
end
function Actors.new(name, x, y, w, h)
local a = objLayer:newObject(name, actor, x, y, w, h)
a.dir = 1
a.hv = 0
a.vv = 0
a.coll = {left=false, top=false, right=false, down=false, player=false}
return a
end
function checkObj(a,b)
if a.x+a.width>b.x and a.x<b.x+b.width and a.y+a.height>b.y and a.y<b.y+b.height then return true end
end
function Actors.update(dt)
for i,v in ipairs(objLayer.objects) do if not v.properties.static then
v.coll.top, v.coll.down, v.coll.right, v.coll.left = false, false, false, false
end
function createPlayer(ox,oy)
player = Actors.new("player", ox*tileSize, oy*tileSize, 31, 55)
end
function game.update(dt)
Actors.update(dt)
end
function game.draw()
gr.push()
map:autoDrawRange(cx, cy, 0, 0)
map:draw()
gr.pop()
end
Re: Help with melee attacks
I would really recommend you dropping ATL, it is very outdated and no longer maintained. Use STI instead: viewtopic.php?f=5&t=76983
Re: Help with melee attacks
well, you're most likely right. I hope not to have to redo everything)
Re: Help with melee attacks
A little digging in the STI. I realized that while arranges ATL.
Re: Help with melee attacks
okay, though Papuan code, but it works. Made the attack, the creation of an actor in pleer.x and player.y + 1 to the size of a 1-tile and life of 0.5 seconds. And also delay before the attack 0.5 seconds.
Who is online
Users browsing this forum: No registered users and 6 guests