Day 21: Explosion #6
Particle systems are not my strong suit. Did I spend my entire Monday trying to figure them out anyway? That I did.
In a previous article, I wrote about adding a particle effect to the plasma bomb which visualizes the bomb’s self-detonation. Thinking I had this in the bag because I had already done it once before, I attempted to add an explosion particle effect to my second enemy type to visualize its destruction. Utter chaos ensued, but I’m ending the night with the small win of a successful particle effect implementation.
The first enemy type explodes with an animation. The process of adding an animation is, in my opinion, far easier than understanding how to use a particle effect. To sum it up, you drop each individual frame of an explosion into the animator in Unity and it really does the work for you. With a particle effect, there is a massive list of customizations and specifications to navigate, which is intimidating for a beginner like me.
After combing through countless pages on the Unity Scripting API and Q&A forums, I finally got my settings down. I used Explosion #6 from the GameDevHQ Filebase as my particle effect this time. Because it’s a prefab, I needed to successfully call the object in the Enemy2 script, instantiate it, then destroy it when the enemy was hit. I got wrapped up in little details, such as figuring out where to properly place certain lines of code to create the desired effects I was going for and making sure the effect was visible in the correct layer (e.g. over the character and not underneath the character).
After sorting this out, I tested everything out and came across an explosion looping in the corner of my screen, pictured below. I’m not certain of its origin just yet, but I’ll attempt to remove it tomorrow.
At last, I’ll be able to move into the next section, enemy shields. It seems as if I was stuck on debugging my scripts for ages!