0

I'm using the Corona SDK with the Box2D engine, and I'm trying to make a Flappy Bird style game just to get familiar with the physics engine. I've tried increasing the density of the main character, increasing gravity, changing the scale of the physics stage, etc, but the main character still feels too "floaty".

Increasing the gravity came as close as I could to feel right, but there are still issues. If the user taps the screen quickly in succession, the momentum builds up quickly and the character goes flying up off the screen at high speed. Here is my code right now:

physics.setGravity( 0, 60 ) --default is 9.8

function screenTap()
    flappy.isFixedRotation = true
    flappy:applyLinearImpulse( 0, -300, flappy.x - 3, flappy.y )
    flappy.isFixedRotation = false
end

In the original Flappy Bird game, it seems to have normal gravity, but rapid taps to the screen wouldn't make the bird fly up too quickly. It almost had the feel of something "heavy" like a bowling ball, but obviously in this world objects of all masses fall at the same speed. I don't have much experience with physics engines, so I would appreciate any suggestions.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Matt Vukas
  • 3,225
  • 3
  • 26
  • 37

1 Answers1

2

If you have played flappy bird recently, you should have observed that when you tap the bird in rapid succession, its vertical velocity does not increase! The flappy bird developer seems to have made the bird's vertical velocity set to a certain value whenever it is tapped rather then have it accelerate vertically.

So, my advice would be to simply set the character's vertical velocity to a set value whenever the screen is tapped instead of accelerating it.

ylun.ca
  • 2,504
  • 7
  • 26
  • 47
  • Just limit vertical speed to some reasonable value. – weaknespase Feb 16 '14 at 17:32
  • 1
    In flappy bird, regardless of the bird's vertical velocity, whenever the screen it tapped, the bird's vertical velocity is set positive/upwards. If you were to limit velocity and keep acceleration, and the bird were to be tapped while accelerating downwards, it would require several taps in order to fly it up. – ylun.ca Feb 16 '14 at 17:37
  • This makes sense, I'm surprised I didn't realize it. I guess I have a long way to go in getting familiar with physics engines. Thanks! – Matt Vukas Feb 17 '14 at 01:22