Hi i’m working on a project where the main character will bounce such as the original flappy bird. I’m using a touch event but if the user touches twice really fast then the force is doubled. Also if the character drops from a large height then it takes more touches to bring him back up into the air.
First my touch event:
[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 sprite is defined as a physics object before the game begins, i’m not sure if the density has anything to do with how seemingly heavy gravity makes the player when he is dropping from a larger height:
[lua]
physics.addBody(player, “static”, {density=.106, bounce=.1, friction=1, radius = 30})
[/lua]
any help would be extremely appreciated, thanks.