Creating Enemy Explosions

VFX (Visual Effect) is cool!
And even cooler is to make something explode in a game!

Photo by Pankaj Patel on Unsplash

Explosion VFX

When we destroy an enemy, we want to see that we destroy it. It doesn’t look cool if it just poof, vanishes in the air without making any sound or effect, right?

For that, we need a biig explosion! We will do this almost the same as the powerup animation.

  1. Choose the enemy and open the animation window
  2. Then you select every sprite from the explosion sprite sheet and move them to the animation window
Moving explosion spritesheet to the animation window

When creating animation, remember to untick the loop time from the animations Inspector!

3. In the animator we need an “Idle” state so the explosion doesn’t start right away. Only when we want it to happen.

4. Then we need to add a parameter, Trigger name OnEnemyDeath (False on start)

5. From Idle to Enemy_destroyed, we add a condition that if OnEnemyDeath is true, Enemy_destroyed will happen.
(And untick HasExitTime)

6. Handle for our animator and null check

Handle for Animator & null checking

7. And when our enemy collides with either laser or the player we use SetTrigger.

Set our OnEnemyDeath Trigger

And we are done! :) We have a nice simple explosion animation in our enemy!

Thank you for reading!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Janika Suhonen

Janika Suhonen

From the beautiful snowy country with a touch of "good" humor? Inspired Unity Developer to learn more.