Objective: Creating a jumping animation!
Jumping is a feature we have already created. Now we need to create an animation to make the jumping look even better. We know how to create animations using sprites at this point what we are going to focus on in this tutorial is the organization, coding, and transitions.
To begin, Splice your sprite.
Select your sprite object on the hierarchy and open the animation window. On the animation window select the drop down, and select create new clip.
Save this new “Jump” clip in the same location as our other animation clips.
This automatically adds the animation to the animator window. We need to make a transition from idle to jump and back.
We need a new bool parameter for jumping.
Select the transition from idle to jump and add the condition for when Jumping equals true, turn off the ‘has exit time’ and set the transition duration to 0.
Select the transition from Jump to Idle and add the condition for when Jumping equals false, turn off the ‘had exit time’ and set the transition duration to 0.
Now we need to create the actual animation and control the animation bool “Jumping” with code.
To create the animation you select all of your sprites you want to use. Make sure the right animation is selected on the animation window and drag those sprites into the animation timeline.
I dragged the last frame out to the two second mark so our player would hold that position while he is falling.
This is a good place to break. We have our animation created and the transition in place, all we have to do now is control that transition with code, and we will do that together in the next tutorial!