Adding Double-Jump To My 2.5D Platformer

Today I am giving the player the ability to jump once while airborne, a common stable of many platformers.

Today’s Objective: Extend on the Player Controller to add the ability to double jump (jump from ground, then jump again once while in mid-air).

The Code:

In the PlayerController component, I add 2 new variables which will control the additional jumps:

Then in the Update method where I check “_isGrounded”, I add another jump input check when not grounded:

I also reset the airjumps used whenever the player lands or jumps from ground.

These methods are simply called through an Update check like so:

--

--

--

Unity game developer / C# Programmer / Gamer. Australian (Tasmanian) indie games developer for 10+ years. Currently looking for games industry employment.

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

Recommended from Medium

Publish your first Production grade Kubernetes app on Google Cloud

It’s time to kill the web

The creation of CNFT Audio.

Ruby Iteration for Beginners

VIP 5: Value Liquidity Token Transition & Max Supply

First steps with MongoDB (in C#)

Venue Video Production in Withernsea | ShowReel #Venue #Video #Production #Withernsea https://t.co/w

6 Key factors determining a Fat vs Bloated Model

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
Vincent Taylor

Vincent Taylor

Unity game developer / C# Programmer / Gamer. Australian (Tasmanian) indie games developer for 10+ years. Currently looking for games industry employment.

More from Medium

Creating An Advanced 2D Player Controller Without Any Unity Components! (Part 2)

Zoo Cards as Scriptable Objects

Using Coroutines in Unity

Basics of Optimization in Unity