Constructor
new StatusCoinBar()
Creates an instance of StatusCoinBar.
Initializes the status bar with default values and loads the images.
- Source:
Methods
collectCoin(index, coin) → {number}
Collects a coin and updates the status bar.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | The index of the coin in the array. |
coin |
Array | The array of coins. |
- Source:
Returns:
The updated number of coins.
- Type
- number
resolveImageIndex() → {number}
Resolves the image index based on the number of coins.
- Source:
Returns:
The index of the image to be displayed.
- Type
- number
setPercentage(coins)
Sets the percentage of the coin status bar based on the number of coins.
Parameters:
Name | Type | Description |
---|---|---|
coins |
number | The number of coins collected. |
- Source: