Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having a difficult time trying to understand the Flappy Bird physics. I know it seems simple but I kind of suck at math. I am trying to see if I can make a simple game like this but it is just the dang physics that are throwing me off. I have something like gravity effecting the bird but when you click the screen and I add some amount to the y position but it doesn't look good. You guys have any ideas?

Stuff like:

velocity += -9.8 *;
position.y += 0.5 * velocity;

That is falling but when I tap the device I would like to know how to add upward force but when it loses it continue falling.

share|improve this question

closed as off-topic by Byte56 Mar 1 '14 at 15:36

  • This question does not appear to be about game development within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Show us concrete examples of what you have tried. – user15805 Feb 11 '14 at 22:13
That code was in the update method and created a realistic fall but don't know how to add upward force. – G3tinmybelly Feb 11 '14 at 22:22
This question appears to be off-topic because it is about how things are done in a specific game – Byte56 Mar 1 '14 at 15:36
up vote 7 down vote accepted

The bird falls continuously, and when the user taps the screen, it 'jumps' a bit. That's all there is to Flappy Bird's physics.

We use a variable called vertSpeed to keep track of the bird's vertical speed (positive if it goes up, negative if it falls down). jumpSpeed is a positive constant, to which the speed gets reset whenever the user taps the screen. This will immediately make the bird start its ascension. fallingConstant is again a positive constant, which accelerates the bird's decrease in vertical speed on each update. This makes the bird increase in speed when falling.

vertSpeed = 0;

method Update()
     if (PlayerTappedScreen)
            vertSpeed = jumpSpeed;
     Position.Y += vertSpeed * deltaTime;
     vertSpeed -= fallingConstant * deltaTime;

From here on, all you have to do is experiment with the values, to find a set that works best for you.

share|improve this answer
would the falling constant be something that is small or a larger number? – G3tinmybelly Feb 11 '14 at 22:39
Thank you so much! It works! – G3tinmybelly Feb 11 '14 at 22:43
You're welcome :) – user15805 Feb 11 '14 at 22:44
Interesting. I started to teach my stepson how he could "make a game from scratch" this week (using Processing and a bounding ball), and I was giving the bird a fixed impulse vertSpeed += speedIncrement and upon playing he immediately complained of the behaviour. When I started to assign vertSpeed to a fixed speedIncrement (or jumpSpeed if you want), he then instantly recognizes the actual FlappyBird "feel". – heltonbiker Apr 15 at 20:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.