Damage VFX using animated sprites in Unity
Giving more game feeling with VFX
Objective: show damage animation when the player gets damage
Let’s start creating an animation for the damage. We have to drop the first sprite into the player game object in the scene and adjust the size and the position until it looks good.
Then select the object and create an animation called Engine_Damage_anim. In the animation window drop the sprites for the animation. Next we have to duplicate the object, place it on the other side, call it left_engine and disable both objects. The Idea is to activate the damage animation when the player collides with an enemy.
In the player script we are gonna create a reference to the engines and in the damage function we have to create a conditional to activate each one according to the remaining lives.
And that’s it! We can see the player damage animation in action.