Posts
Programming Update, player death handling and health system update
- Get link
- X
- Other Apps
Health bar implemtentaion
- Get link
- X
- Other Apps
I recently added a health bar to the game. Prototype: - The health consists of a black rectangle with a red rectangle on top. - When fully healthy, the red rectangle will perfectly cover up the black rectangle. As the character takes damage, the red rectangle will decrease according to the damage taken. This would show the black rectangle underneath, therefore showing the player's current health as well as the maximum health. - You can test the health by using the enter key (take 20 damage) and the space key (heal 20 health). Bugs - I had a problem with the decreasing of the red rectangle as a way to show damage taken. Fixes: I cropped a red rectangle from Google and used that as the source image, and I used .fillamount to decrease the length of the red rectangle. Update 1 - Instead of the health instantly disappearing, I changed it so it gradually ticked down to the designated health. This is done by using a combination of IEnumerator, for loop, StartCoroutine, and WaitForSeco