Creating Enemy Explosions
VFX (Visual Effect) is cool!
And even cooler is to make something explode in a game!
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.
- Choose the enemy and open the animation window
- Then you select every sprite from the explosion sprite sheet and move them 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
7. And when our enemy collides with either laser or the player we use SetTrigger.
And we are done! :) We have a nice simple explosion animation in our enemy!
Thank you for reading!