hi i have a problem with my touch event in my game. I am trying to make a game with controling like a pogo jump. Like a character is jumping all the time and when you touch he stop. I made the reapeat jump like this:
function pogo_jump( event )
if (jump_completed == false) then
jump_completed = true
mario:applyForce(0, -4000, mario.x, mario.y)
end
end
function on_hit(event)
if(event.phase == “ended”)then
jump_completed = false
end
end
Runtime:addEventListener(“enterFrame”, pogo_jump)
mario:addEventListener(“collision”, on_hit)
and then for stoping the jumping i have this:
function run( event )
if (event.phase == “began”) then
Runtime:removeEventListener(“enterFrame”, pogo_jump)
elseif (event.phase == “ended”) then
Runtime:addEventListener(“enterFrame”, pogo_jump)
end
end
Runtime:addEventListener(“touch”, run)
Problem is that when i end the touch character jump heighr then he should be, like a 3 to 4 times heighr than i have set for my pogo jump
i am sorry if i didnt explained well but i am new to a corona and lua