Player Run Animation Part 1!
Objective: Create and Implement a running animation!
We have an idle animation now and our player looks create standing still, however they don’t look as great when moving with an idle animation still playing.
Just as with the idle animation I have a sprite with the frames for a running animation.
Slice this sprite at 256 x 256.
with the sprite selected navigate to the animation window and select the idle drop down box and select Create New Clip
Save this in the same animation folder as the idle. Since we did this on the sprite object the run animation will automatically added to the animator view.
Select all the sprites under run and drag them onto the animation time table.
Preview the animation
Set the sample to 30
Way better! Now we need to venture to the animator window and create transition to and from Idle and Run.
We want to control this transition, to do this we need a parameter. Create a float parameter for “Move”
On the transition TO run add the condition move is greater than 0, Has Exit Time is unchecked and set transition duration to 0.
On the transition back to Idle uncheck has exit time, transition duration is 0 and move is less that 0.1
Now we need to control the Move parameter with code. For the sake of code readability we want to create a new script dedicated to the animation of the player. We will cover this in the next tutorial, I’ll see you there!