Visualizing player health

Kasper Møberg Rasmussen
2 min readJun 14, 2021

Usually when making a video game that needs to visualize player health, a health bar or lives counter is the simple and generally reliable way to do it, but it’s also not very interesting to look at.

So lets create some visualization for the player model being damaged.

Here is my healthy player character.

GamedevHQ provided me with some 2D animations to represent player health, a fire with a smoke trail.

I’ve gone through how to create a 2D animation in previous articles so won’t repeat it here.

So now I’ve got a couple of burning engines, but I don’t want them always active, so I need to activate the game objects the animations are attached to through code when the player takes damage.

First thing I’ll need for that is references to the deactivated burning engine animations, in the player script.

Then I integrate it into my TakeDamage function by checking if there is a burning engine with an array index equal to my lives-1, and activating it if there is.

And there we go.

--

--

Kasper Møberg Rasmussen

Masters graduate of Learning and experience technology from University of southern Denmark, with a passion for the future of interaction.