
Imagine a heart sprite, which I'm gonna get to work on immediately after I post this, in place of that white square. The health bar depletes as Hensen looses health, pretty much as you might expect.

It's also fully functional! I've updated the health section of the HUD manager script to, rather than change the text as it used to, re-size the health-bar rect to the player's current health ratiod to their health at the start of the game multiplied by the width of the health bar, which is a serialized field incase I want or need to change that later.
If you're wondering why I created a local variable for the player's current health, it's solely because it feels like a waste of complexity to have my code create a function frame for 5 different calls to playerController.GetHealth() that all return the same value.
0 comments