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!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store