Creating Enemy Explosions (2D Space Shooter)
Particularly in Shoot ’em Ups, First Person Shooters, and even some side scrolling platformers, it can worthwhile to really bring the most out of the destruction and/or havoc the player can cause. In the 2D Space Shooter I’ve been working on, I could’ve instantiated a sprite explosion effect over the top of the enemy after it’s destroyed, instantiated a particle system explosion effect over it, or triggered an animation on the sprite itself.
I ended up going with the last of these, which involved creating the animation using a series of textures dragged into the Unity Animation window, and then setting up an Animator Controller for the enemy with an ‘OnEnemyDeath’ trigger to cause this one-shot animation. I placed the trigger on the transition between a default animation state and this one, set ‘HasExitTime’ to 0 and stopped it from looping, and could then call this trigger from another script by accessing the object’s Animator component.
After a few bug fixes, the animation can run while the player’s able to pass through the exploding enemy without taking damage (as it felt a tad unfair for the player to take damage by bashing into a defeated enemy). The effect is also fortunately quite inexpensive, at least when compared to some particle effects but does of course require the right visuals assets in order to pull it off.
***
Working on this got me thinking a bit more about destruction and violence in video games. On one level, I suppose it’s a matter of giving the player auditory and visual feedback for their actions (sometimes excessive amounts), and perhaps on another level there’s just something satisfying about destruction for many of us, at least in a fictionalised context. The visual and audio flare of it is certainly impressive, and far removed from mundane, day-to-day existence, but perhaps there’s also something to be said about the desire to leave a mark or make some impression on the world.
I’m thinking about the old days of First Person Shooters, and the way the impact of grenades and bullets was only temporary, typically fading away after a couple of minutes. There was something kinda profoundly unsatisfying about seeing the destruction you’ve caused just fade out of existence as if it never happened, and as if you’d never been there. And then, on the flip side, there was something so profoundly satisfying out of seeing the aftermath of a battle you took part in as in some of the Battlefield games (a building which collapsed during the conflict, a roof which caved in, the crumbling remains of a bridge). I’m also reminded of games like Just Cause 2 (which I’ve played to death) and the satisfaction and permanence of the main things the player destroys, and how so much of the game is built around the player just finding things to destroy, destroying them, rinse and repeat. Guess it’s kinda of a ‘I was here!’ message in a virtual world.
Quite off-topic, but it just got me thinking.