Player Damage Visualization

In the same spirit as having the enemies “go boom”, it’s would be great to also show the player has taken damage.

To achieve this I made an animated fire that was turned into a prefab. This prefab is then placed inside the player prefab, one for each wing 😀

I decided to make it random which of the wings would take damage, instead of having a specific one show up on the first hit.

The fire prefabs are assigned to the _playerHurtVisualizer array in the unity inspector. Whenever the player is set to take damage, it calls the ShowDamage() method. This makes a random decision of which wing will display the damage if no damage has been taken already, this is done by the _previousDamage being declared as -1.

Displaying the damage then is pretty easy, just activate the gameobject, and voila! 😁



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