Flappy Bird like Player Controls

Hi I’m a newbie with Unity3D. I’m trying to make my player jump and fall naturally with gravity. Now I have 2 problems.

  1. When I trigger jump multiple times quickly the player is behaving like a rocket and going through the roof.
  2. When there is no jump, the player should fall down with an increase in gravity (the fall should increase gradually).

Im using this for my jump:

rigidbody2D.AddForce(new Vector2(0f, 800f));

#1. The player is behaving like a rocket because you are adding force every time you “jump”. Also 800 force seems like it might be a bit much, of course I am assuming your character has a mass of 1. If the mass is ore than 1 then 800 might be fine. You can try:

rigidbody2D.velocity.y = whatever number u want;//NOT 800

this will affect the velocity directly, although this is not usually recommended for accurate physics simulations, for jumps it works fine. Do not use something like 800 for the velocity though as that is definitely way too much. use something like 8;

#2. If you want your character to fall down faster, the easiest way is to make gravity stronger. No coding involved for this, just go to: Edit, Project Settings, Physics 2D, and for Gravity Y put a bigger number but make sure there is a - sign first. Otherwise gravity will make you fall up instead of down.

If my answer is correct please don’t forget to mark it as correct.

This is a free source code on github I recommend you to check and test it :slight_smile:


This is a whole kit, just for 10 dollars. You can add your own graphics.

This is the answer I would use, Note! This is C#

//Put this above void Start()
public Vector2 jump = new Vector2(0,200);
public Rigidbody2D rb;

//Put this in void Update()
if (Input.GetKeyUp(“space”)) {

NOTE! This may have an error. So, there is your awnser for a jump!