Hi guys, i’m developing a game where the character bounces much like the flappy bird character. I have it working well, but i’m handing the bouncing effect with a touch event and when the user double touches really quick it basically doubles the force behind the player.
Also, take for example if the player is dropping from a higher height then the gravity seems to be too much and i have to touch many more times to bring the player back up, and i just can’t seem to figure out how to make every touch consistent with the amount the character bounces.
here is my function for the bounce effect:
[lua]
function flyUp(event)
if event.phase == “began” then
if gameStarted == false then
player.bodyType = “dynamic”
instructions.alpha = 0
tb.alpha = 1
addColumnTimer = timer.performWithDelay(1000, addColumns, -1)
moveColumnTimer = timer.performWithDelay(2, moveColumns, -1)
gameStarted = true
player:applyForce(0, -300, player.x, player.y)
else
player:applyForce(0, -460, player.x, player.y)
end
end
end
[/lua]
…and here is where my player is defined as a physics body:
[lua]
physics.addBody(player, “static”, {density=.106, bounce=.1, friction=1, radius = 30})
[/lua]
any help would be extremely appreciated, i just want the player to always move up the same amount no matter how many taps and how much he has dropped.
Thanks