Player Hurt VFX using Animated Sprites in Unity
How to add Visual Effects to display Damage on Player
In this article we will add some visual effects for when the player is damaged. Damage on the the wings/engines for each when health is 2 and 1. Explosion on player when health is 0.
Player Damaged VFX — Engine failure
Create a gameobject for damaged effect
Create animation for gameobject
The damage effect is the same on both the left and right size so we can use the same animation. We only duplicate it, so we can keep it as child on the Player. This way it will move with the player.
Create references to the Damaged game object
if health is 2 then SetActive
if health is 1 then SetActive
Explosion on player death
Explosions make everything better. We already got explosion on enemy death, now let’s make the player explode too.
Assign Explosion prefab
if health is 0 then
Instantiate Explosion prefab at player position