Introduction to the animation system

Unity has a brilliant and effective animation system named Mecanim. It works wonderfully with 3D animation, as well as for 2D animations. However, we will use some basic features, since we are going to use just a couple of Sprite animations to begin with.

Of course, feel free to explore the official documentation by visiting https://docs.unity3d.com/Manual/AnimationSection.html or following the official video tutorial: https://unity3d.com/learn/tutorials/s/animation.

When it comes to the animation system in Unity, we can talk about State Machines. Each animation is a node and the character can change animation according to certain variables of the State Machine. You can see an example of an animation State Machine in the following image. Keep in mind that, usually, animation state machines are much bigger and more complex in a real project than the ones used to explain how they work:

For our game, we will be implementing an explosion animation each time something is destroyed. It is a simple animation, but by showing you how to create it, you will be able to implement other types of animations for other elements of not only the games within this book but also your own projects. However, for our project, the animations will come into effect when the player's spaceship runs out of life, and when enemies' spaceships, planets, and comets are destroyed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset