That’s gotta hurt! — A quick guide to adding a damage VFX to a player

At the moment we have a player who, apart from our UI lives display, does not react to getting damaged. We are going to fix that in the following article.

We are not going to go over animating sprites in this article, if you need a refresher see this article.

I have the following animation that we are going to child to our player and turn on and off as the player takes damage. We can attach one to each wing so we can show the player being in a critical state with one more damage to cause a game over.

We assign a reference to the left and right fireballs on the player script.

We can also create a function to pick which fireball to activate first so there is a bit of randomness to our game.

Now we just need to make sure the new function is called during our damage function.

And then we can test it.

There we go, a nice bit of visual feedback for the player when they take damage.