2D Game Dev Journey — Day 9: Visual Effects (VFX)
Welcome to 2D Game Dev Journey — Day 9: Visual Effects (VFX). Today I will be creating some VFX to help add some more pop to our game.
Starting Point & Setup
Today we will be starting right where we left off in 2D Game Dev Journey — Day 8: User Interface (UI).
To start creating my enemy explosion effects, I first started by setting up my animations for it. The animation I created is the following:
Now, this animation is actually a bit different from the previous ones I had done with the powerups. The powerups are meant to play that animation on awake, but I want to trigger the explosion only when the enemy is destroyed. To fix this, I went into the Unity animator and set up a boolean parameter named isDestroyed which I can manipulate through code to properly trigger the enemy explosion animation.
After setting all this up, I went into my “Enemy” script and set the boolean isDestroyed to true when it is destroyed. I got the following result below once all implemented in code.
Definitely adds a lot more life to the game. Let’s keep adding more elements with some asteroids.
When it comes to the asteroid, I will be using it to actually be a soft intro for the player. The asteroid will simply be animated to rotate and stay in place until the player shoots it. Once shot, the asteroid will be destroyed and the enemies will begin to spawn. Once implemented, I got the result below:
Next, I am going to add some thruster effects to help sell movement in space.
Setting up thrusters was pretty straightforward. I simply utilized the idea of parenting and children and created the animation as I have been doing thus far. The results are as shown below:
Last but not least, I will be creating some effects to show that our player has been damaged. I created this similarly to how I did the thrusters. The only difference is that in code I had to turn on each of the effects the more our player got damaged. The following is the result once all implemented:
Thanks for checking in and reading today’s article. Tomorrow, I will be adding some Post Processing which will help our game shine even further. As always, comments and critiques are welcome. If I have made any mistakes, please let me know so I can correct them for future readers. If you would like a more in-depth tutorial about anything I went over today, let me know and I will take the time to write something up.