I have a tap and touch code. I need to have my character go from idle to running on touch and jump on tap, but I also have to work in a way for him to attack. My other issue with the code I have is after the jump, he doesn’t go back to idle position. Any advice?
local function jumpTap( event )
if event.numTaps == 2 then
animate:setSequence("jumping")
animate:setLinearVelocity(0,-200)
animate:play()
else
animate:setSequence("idle")
animate:play()
end
return true
end
local function onTouch(event)
if(event.phase == "began")then
animate:setSequence("running")
animate:play()
elseif(event.phase == "ended")then
animate:setSequence("idle")
animate:play()
end
end