Hi everyone!
I’m building a simple game in Corona (infinite scrolling with obstacles).
I have a sprite object with 3 sequences: walking, jumping and crouching.
This is the code I use to jump or crouch depending on the swipe direction (up and down):
---peste is the sprite object
local function swipeEvent (event)
if (event.phase == "ended" ) then
if event.y > event.yStart then
print ("Crouch")
peste:setSequence("crouch")
peste:play()
elseif event.y < event.yStart then
print ("Jump")
peste:applyLinearImpulse(0,-15.5,peste.x,peste.y)
peste:setSequence("jump")
peste:play()
end
end
end
Runtime:addEventListener("touch", swipeEvent)
I need a way to let it start walking again after the event.
Can you help me?
ps. I’m entry level and not so good in coding