What Beats Jumping? Double Jumping!!
Here’s a quick guide on implementing double jump functionality into your character controller.
We’ve completed the basic setup for our character controller and we can move left/right and jump as needed. However, a platformer wouldn’t be complete without a double jump so here’s a quick run-through on how to set that up.
There is our original jump code. We can create a double jump function by checking a bool variable in our else statement:
When we jump from the ground, canDoubleJump becomes true, and if we press space again we add an additional jump height and then set canDoubleJump back to false.
Easy peasy. Our player can now double jump all over the place and we’re ready to move on to collectibles. See ya there!