Animating body parts for character movement events
In this recipe, we'll learn to animate thehat
of the Unity potato-man character in response to a jump event.
Getting ready
For this recipe, we have prepared the files you need in folder 08_03
.
How to do it...
To animate body parts for character movement events, follow these steps:
- Create a new Unity 2D project.
- Import the provided
PotatoManAssets
package into your project. - Increase the size of the Main Camera to 10.
- Set up the 2D gravity setting for this project – we'll use the same setting as from Unity's 2D platform tutorial, a setting of
Y= -30
. Set 2D gravity to this value by choosing menu:Edit | Project Settings | Physics 2D
, and then at the top change the Y value to-30
:

- Drag an instance of the PotatoMan
hero
character2D from theProject | Prefabs
folder into the Scene. Position this GameObject at (0, 3, 0). - Drag an instance of the sprite
platformWallBlocks
from theProject | Sprites
folder into the Scene. Position this GameObject at (0, ...