Galaxy Shooter 2D — Creating Sprite animations #7
In the previous article, I implemented a new powerup to my game: Triple Shot! Today, I’m going to show you how I animated the powerup, and how you can animate anything you want in Unity!
Creating an Animator Controller
Before we begin creating or adding our animations, the GameObject needs to have an Animator Component and a Controller. Those two are necessary to make animations work and set the animation behaviors. There is an easy way to get both right away:
- Add the Animator Component to the GameObject to animate.
- Open the Animation Window, and create an animation.
- A File Explorer window will pop up and ask you to select a folder to store that new animation. Once you have selected one, click on “Save”.
- The Animation window will change, and if you check the folder where you saved the animation, you’ll see the animation and the Animator controller. Additionally, the Animator component will auto-assign that new Animator controller so you don’t have to do anything.
I have a set of sprites that make for a good animation sequence, and to fully animate the powerup, I just have to select the sprites, and drag and drop them in the Animation window.
And that’s it!
It’s that simple, really. However, I skipped the Animator window, which is another whole topic on its own. Perhaps in a future article, I will talk about it and the underlying complexity that it has.