Add double jump animation to player character in Unity

Daniel Kirwan
2 min readAug 12, 2021

--

Objective: Add in a flip animation when the player does a double jump

If you have read the previous articles about the animation controller then continue on but if you’re coming in fresh I assume you know what you’re doing.

Add in your double jump animation. I only want my double jump to happen when the player is currently in the jumping animation. I have set up a parameter of IsDoubleJump as a trigger.

I have 1 transition to double jump from jumping with the condition of IsDoubleJump = true. I then have two transitions that take the player to either running or idle.

  1. to running — This happens if the speed parameter is > 0.1
  2. to idle — This happens if the speed is < 0.1 & that IsJumping is false.

Now lets move into the code. If you have read my article about how I implemented the double jump then this should look very familiar.

I have an if/else statement that determines if the player is on the ground. The above code is in the else statement, so if the player is not on the ground then they are in the air. If the player has previously pressed the space bar while on the floor then the doubleJump bool will be turned to true.

If doubleJump is true then the player can jump again and here is where the parameter is being used.

--

--

Daniel Kirwan
Daniel Kirwan

No responses yet