2D Shooter: First Sprite Animation

Objective: Add an animation (above) to the powerup.

First, let’s create an animation folder in the assets folder. Now click on the powerup object and then go to the task bar and go to window > animation > animation.

From here another window should pop up, and you can dock it next to the game window if you’d like to. Click on “create” to create an animation file, make sure its organized under the proper folder, name it, and then click “save.” Now make sure you have all the frames you need for your animation imported into Unity.

Make sure again that you have the powerup object selected, and then click the record button in the animation panel. It should glow red.

You can click the first frame, then use “shift + click” the last frame to select them both and everything in between them. Drag these frames into the animation panel. You can click the record button again and Unity will create two files in the animation folder. One will be the actual animation file we just created, and the other will be the controller where you can modify how the animation starts and loops in the game.

For my animation, I spaced the frames so that the whole animation cycle lasts about half a second.

Now the animation should be working! In the inspector when the animation file is selected, you can make sure its on loop, so the animation will keep going on and on.

Currently learning to code with the help of GamedevHQ in order to someday my my game ideas come to life!