Creating Enemy Explosions

Rook Sullivan
1 min readMay 23, 2021

The space shooter game is now mostly functional, so it is time to add in some nice visual effects. The first effect I’m going to add is an explosion that occurs when an enemy dies. As with previous animations, I simply needed to drag and drop the sprites into Unity’s animator to create the explosion.

After adding this animation, however, the enemies are just playing the animation over and over as long as they are alive. I need the enemy units to only play this death animation when destroyed. This required use of a new class called Animator, and subsequently a new tool in Unity.

Within the Animator tool in Unity, I needed to create an empty state for the animator to idle in until it was called to play the animation. I then needed to set a Condition that would cause the animation to play, that I would then be able to turn on from the script.

By setting up the proper parameters in the Animator tool within Unity, I could then call on it to play the animation when the enemy was destroyed.

--

--

Rook Sullivan

Non-binary game dev sharing my experiences in Unity.