Player Animations - Part 3 (Coding the animations)
2D Game Design with Unity
🕑 This lesson will take about 8 minutes
In the previous two lessons, we looked at how to create 2D animations for your player GameObject in Unity on a timeline (using sprites and sprite sheets), and how to configure the transitions between the different animations using the Animator. In this lesson, we will look at how to control when each of these animations plays using code written in the C# programming language. We will add this code to the existing ‘PlayerController.cs’ script created in earlier lessons in this course.
These are the three steps involved in creating player animations:
Game art, tiles and sprites from the Free Pixel Space Platform pack are used in this lesson video and can be downloaded from the Unity Asset Store.
Is YouTube blocked at school? Watch on Google Drive.
Sample code
Next lesson: Making the player look left and right