How to make character jump mid-air ?

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

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

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.