Double Jump in Unity

Objective: allow the player to jump twice before touching the floor again.

We have ready the player jump, but now we want to give the player the chance to jump again before touching the floor.

In the player script I created a new bool variable called _doubleJump, then in the update method when we check if the player is grounded, if it is true we set the value of the bool to true and if it is false we check for the space key and if the _doubleJumpp variable is true, in that case we add the jump height to the vector and set the value of _doubleJump to false to avoid to jump again.

And that’s it!!!! Now the player can jump twice.

--

--

--

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

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

Recommended from Medium

Visualization and code generation of linked smart contracts as an extension of FSolidM

Dynamic Multi Column Search with JPA Criteria.

Type System Savings

Succeeding in your first junior developer position

Automate Virtual Fitness: Take Payments, Host Live Stream, & Create On-Demand Videos

Migrating a Multi Client Web Service to AWS

Polypunks Gets Infected

Implementing a lightweight transcription microservice with gRPC

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
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

More from Medium

Player Jump in Unity

Creating a Simple Cooldown System In Unity

Platformer: Player Animation Part 4

Creating Rewarded Video Ads in Unity