How to add Double Jump to your Game

Adding to the Jump only once while in the air

James Lafritz
Dev Genius

--

Now that I have my Player moving in the game and I can get from platform to Platform it is time to implement double jumping. I do need a way to reach the higher platform after all.

I need a way to know if the player has already performed a double jump.

If the Player is grounded I set the Double Jump to false.

If the Player is not on the ground. If the Player has not doubled jump and the Jump Button is pressed then I add Jump height to the velocity.

I almost forgot to make sure to set the has double jump to true.

I can now reach the higher platform. I did have to change the players Jump Height from 6 to 6.5.

--

--

Excited about changing my hobby into a new carer with GameDevHQ course.