How to add Double Jump to your Game

Sometimes we want to challenge the player in our games, adding more obstacles to make the gameplay harder. Then you get into a point when you add double jumps, forcing the player to jump twice to reach some roof, get into new path or simply avoid some obstacle.

How do we handle with double jumps?

It’s absolutly easy, depending on the programmer there can be different ways to do it. But I’m gonna show you the easiest one, using a bool variable.

Let’s explain a little bit this code. Here we have a State Machine to determine when the player is jumping or not, inside the TickState method we define how the jump should be implemented. First, the game checks if the Jump key is triggered and if the double jump bool variable is true.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response