How to make character jump mid-air ?

#1

I’m trying to make a game like flappy bird please help me out . l want the object to jump mid-air. I’ve figured out the gravity part but can’t make it to jump

0 Likes

#2

Here’s one simple way to do it. Put this in the update tab of your character:

gravity = 5;
flapHeight = 50;
this.y += gravity;
if(isKeyJustPressed(“up”)){
this.y -= flapHeight;
}

3 Likes

#3

thank you so much!
actually the code didnt work at first, but when i added (‘up’) instead of (“up”) it worked.

also sorry for the late response.

0 Likes