Devlog 7 – PC Player Health

Today I worked on implementing the UI and damaging ability for the PC players.

Health is actually very simple, its just a number that represents how much life the player has left. In this case, I’ve set the players maximum health to 100, this is how much they start with. Then, when the player is touching a damager it uses the following parameters:

It’s pretty self explanatory. The Damager Per Hit parameter determines how much damage will be done to the player per hit, while the second variable regulates how often a hit is applied. So if the player were to stand on the magma for 10 seconds, they would die (although I haven’t implemented death yet).

This is the code that should be used when damaging a player. By forcing the damage to come through this method I can force the health bar slider to update only when the player takes damage. This also ensures that the players health never goes below zero, thus preventing unexpected bugginess in the future.

You might also notice in the video that there’s a small representation of the player in the bottom left corner. You might recognize this character from somewhere, the reason behind our choosing of it being that it’s a very simple character to recreate. This character wont actually be in the game, its just a debug model.

Published by Loochis Loo

I am an aspiring programmer who likes to create fun applications. I also do some electronics projects.

Leave a comment