Adding some VFX to the Player

Last article we created a new Explosion to go with our destruction of an Asteroid that would start our Game.

In this section we’ll spruce up our Player a bit — giving them a Thruster, and also implementing some visual cues on the Player to check their Health amount!

That’s a good looking Player Ship! (Until it gets damaged… but still beautiful)

Player Thrusters

In creating the Player’s Thrusters, it will be a permanent Child of the Player object. This ensures it follows the Player.

So, we’ll create the Thruster Game Object and attach it to the Player:

Basis for out Thruster

Then we can position it accordingly to our Player, and scale it to what we deem correct:

Scaling and positioning the new Thruster

With these Thrusters, I’m fortunate to have additional Sprites I can use to animate it, so I will do so by creating a new Animation while having the Thrusters selected in the Hierarchy. The Animation looks like this:

Nothing fancy, but subtlety is king!

And this is how it appears when we’re flying (swimming? zooming?) through Space:

Thrusters, check!

Player Damaged VFX

Now we’ll create some damage indicators on our Player that correlate with how much Health they have left!

First we’ll create the VFX as a child to the Player so that we can simply enable/disable them when needed:

Creating our Engine Failures_VFX

Then we’ll position these new VFX to some appropriate places:

Make them look normal-ish.

Make sure to change the Sorting Layer and Order in Layer of these new VFX as well!

Next create an Animation for the Engine Failures (if you have the extra Sprites), and link the Engine_Failure animation clip the the Animator Controllers of each Engine:

Add an Animator controller if needed.

Now test if the Damage indicators look alright and operate with their animations:

Damage Indicators, check!

Next we’ll jump into our Player script and create new references to our Engine_Failure damage indicators:

New way of creating variables.
  • When creating variables or references inside a script, if two or more are of like kinds, you can create multiple variables/references in one line. Separating them with a comma!

Now into our DamagePlayer() function. We’ll activate one Damage Indicator per life lost:

Activating Damage Indicators

And finally link our Engine_Failures in the Player’s Inspector:

Perfect! Now our Player has some more visual cues on their Health, and they look good doing it!

In the next article we’ll begin touching more on visual enhancement. This time in the form of Post Processing volumes and layers!

Audio Engineer turned Unity Game Dev. Will be combining both my skillsets when appropriate, and will be documenting my Unity Dev growth in these Medium Articles

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