Idle and Walking Animation For Moss Giant
We are going to be focusing on creating the moss giant AI soon, but first we should set our animations. To begin take your idle image and slice it to the desired size.
Now we take the first slice and drop it into the hierarchy, and rename “Sprite”
The order in layers needs to be set to the same layer as our player which we previously set to 50.
Now we need to create an empty object and name it after your enemy. Zero out your sprites’ position and child the sprite under the empty object.
Now we can position the enemy and scale them to proper size. Select the sprite and change the scale, then position with the parent object.
Now to start the animations simply select the sprite and on the animation window select create new.
Save this into a new animation folder under your character.
With this done simply grab all the slices of the idle animation and drag them onto the animation view.
For me, I set the sample rate to 15. You can always press the play button on the animation window to preview your animation.
Now simply repeat these steps for the walking animation. Slice the sprites, select the sprite object, select create new clip on the animation window save in the animation folder and name the second animation “Walk”
With the walk animation finished we can head into the animator view and make transitions for these animations. Begin with making a transition from Idle to Walk and back to Idle.
On the transition to Walk we want the ‘has exit time’ to be true and the transition duration to be 0.
On the transition back to Idle we need to create a trigger Parameter “Idle” and this trigger is the condition that will allow the transition back to Idle.
The ‘has exit time’ needs to be false as the transition duration also needs to be set to 0.
And we are finished. This is perfectly set up for us to come in next time and create our Moss Giant AI in the next tutorial! Don’t be afraid to experiment with your animations and I’ll see you in the next Tutorial!