Constructor
new HealthBarUI(element)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | The health bar container element |
Members
currentHealth :number
- Source:
The current health.
Type:
- number
element :HTMLElement
- Source:
The health bar area container element.
Type:
- HTMLElement
healthBack :HTMLElement
- Source:
The health bar background element.
Type:
- HTMLElement
healthBar :HTMLElement
- Source:
The health bar which changes size based on player health.
Type:
- HTMLElement
largestHealth :number
- Source:
The largest health recorded.
Type:
- number
title :HTMLElement
- Source:
The health bar title element.
Type:
- HTMLElement
Methods
changeHealth(newHealth)
- Source:
Changes health stat and refreshes bar.
Parameters:
Name | Type | Description |
---|---|---|
newHealth |
number | The new health of the player. |
refreshHealthBar()
- Source:
Sets the health bar size based on max health achieved and displays the current health.
setFullHealth(health)
- Source:
Sets the largest health value and refreshes the health bar.
Parameters:
Name | Type | Description |
---|---|---|
health |
number | The health value. |