Day 116: Jump and Animation Part 2

Tyler Smallwood
3 min readApr 1, 2022

--

Objective: Finish Jump animation.

As we did for the idle and run animation, with the player sprite selected we will create a new clip name Jump.

We will add in some of our sprite from the sprite sheet for the jump animation. I adjusted some of the sprites to get a better looking jump animation.

In our Animator, we will need to add transitions to the jump animation. We will have transitions from the idle and run animations.

We will create a bool for IsJumping.

For the transitions going to the Jump animation we will have Has Exit Time and Fixed Duration off and Transition Duration at 0. There will be condition of IsJumping is true.

Going back to Idle we will just check to see if jumping is false.

But for going from Jump to Run, we will need to check to see if jumping is false and speed is greater than zero.

Now we have the animator set up, we will go into our animation script. Here we will create a method to jump. We will setBool to the pass in value that we will get from our player script.

In our player we will set the jump to true when we hit space.

Currently, we have no way to set the jump bool to false. To fix this we will start a Coroutine to set the bool to false.

In the IEnumerator, we will wait a second and then set the bool to false.

Now we have an animation to go with our jump! Thank you for reading and have a wonderful day!!

--

--

Tyler Smallwood

I am passonate on learning to program and use Unity to become a skillful Unity Developer