How to add Double Jump to your Game

--

Double jump is actually a really easy thing to add to your player. All we need is a Boolean variable and the some if…else statements and you have a working double jump.

I set the above variable as a class variable but we could make it a local variable as well. I have it serialized for testing purposes.

The jump code is pretty straight forward. The first If checks if the player can make an initial jump from the ground, when they do they are give the ability to jump a second time, if the player pushes the jump button again before they hit the ground they can jump a second time.

we can fine tune how the double jump behaves in the inspector.

--

--

No responses yet