Damage VFX Using Animated Sprites In Unity
When making a game or even most forms of software, you will come across a number of various situations when you want to relay visual information to your player so as to create an impact to their actions and the relation it has within the program. Seeing a button highlight under your mouse, having already viewed items within a menu dim or become shaded, or in the case of the example, we will be reviewing in this article, having the player in a game show a visual impact resulting from receiving damage.
Now seeing your life deplete in the UI is a nice way to represent the number/technical side of things, but seeing the impact damage has on your player is a great way to make the player feel more invested in their character.
By creating separate animations for the individual engines catching fire when the player takes damage, I’ve created another form of visual prompts to display the player’s life. If you notice, I duplicated the object that I attached the explosion animation to and placed it over each of the player's wings.
Then I simply used the SetActive() behavior to activate them when the player takes damage!