Platformer: Double Jump


In this article we will cover that platformer staple of double jumping because sometimes we need to put on our Reebok Pumps to be able to get to a platform that is just out of reach.


  1. Jump once and while in the air be able to jump one additional time.

Double Jump

We will need to be able to track if we can double jump or not, so we are going to create a bool called canDoubleJump.

The first time the player jumps we will set this true

The player is no longer grounded, but we still want to be able to jump one more time when we press the space bar. In the else, we want to add another jump height to the existing yVelocity.

We are never the canDoubleJump bool to check if have already hit the space bar, so we can spam the button to get a Flappy Bird mechanic where you can stay in air for as long as you hit the jump button.

In the Else, when we press the space bar again to double jump, we want to see if we can using the bool canDoubleJump. If that is true, which we set to true the first time we jump, we will add another jumpHeight to the existing yVelocity. We cannot forgot to set canDoubleJump to false after this because if we do not you will still get the same Flappy Bird, flying behavior as before.

Double Jump Code

There is how you can create a double jump mechanic for your platformer. Cheers!




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Introduction of Aws Lambda With Java

What is SMTP?


Don´t read this. It’s just letting some steam go

[LeetCode][python3]0015. 3Sum

Building a Batch Payment Proccessor in Swift using a Queue Data Structure PT. 1

Frequency counter pattern

The Road Back Home

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
Ryan McCoach

Ryan McCoach

More from Medium

Adding a camera shake effect

The Great Fleece Development Recap (Part 2)

Understanding the Body Settings in Cinemachine Virtual Cameras

Update: UI Panels in Unity