Animation of 2D sprites in Unity is fun :)
One could imagine 2D sprites as a series of relevant images set in an order which upon a successful run in a single stretch gives an illusion of movement. That is also the core of films and animation.
In Unity, we achieve animation of pre-built sprites using the animation toolkit.
As you can see below, the powerup is a falling image sprite and upon collision with the player, it disappears and allows the player some extra bullet power.
Let us animate it to make it look far more interesting.
- Open the animation window and snap it right beside the game view.
- Select the animation tab where the “Create” option is visible. Click on it and give a name of choice to the animation in process and save it in the animation folder.
- Select the object that you are about to animate, go to the animation window, and then drag the sprites associated with the object into dopesheet.
- Click the red record button and record the animation by play button and then again stop the record button to complete the process.
- here, the final result shall be verified by observing the following signs.
- If it somehow fails to attach the animation, it could be assigned manually also by first, adding an animator component and then filling the controller box from the project’s animation folder having the recorded animation.
- The final result is now in place :)
Thank you very much