Constructor
new StatusBar()
Constructs the StatusBar, loads its images, sets its initial position, size,
and initializes the health percentage to 100.
Members
IMAGES :Array.<string>
An array of image paths representing different health levels.
Type:
- Array.<string>
percentage :number
The current health percentage displayed by the status bar.
Type:
- number
Methods
resolveImageIndex() → {number}
Determines the index of the correct image in the IMAGES array based on the current health percentage.
Returns:
- The index corresponding to the current health level.
- Type
- number
setPercentage(percentage)
Sets the health percentage and updates the status bar image accordingly.
Parameters:
| Name | Type | Description |
|---|---|---|
percentage |
number | The new health percentage to display. |