new Lives(numberOfLives, sprite)
Creates lives that can be seen in the top left hand corner
Parameters:
| Name | Type | Description |
|---|---|---|
numberOfLives |
Number | the maximum number of lives |
sprite |
sprite | the sprite that the lives will look like |
Properties:
| Name | Type | Description |
|---|---|---|
startX |
Number | the starting X value to draw the live sprites at |
livesArray |
array | the array that holds the sprites of each life. |
- Source:
Methods
amountLivesLeft() → {Number}
Returns how many lives currently stored
- Source:
Returns:
the number of lives left
- Type
- Number
constructor(numberOfLives, sprite)
Creates the Lives class
Parameters:
| Name | Type | Description |
|---|---|---|
numberOfLives |
Number | the maximum number of lives |
sprite |
sprite | the sprite that the lives will look like |
- Source:
loseLife()
Removes one life
- Source:
restart()
Restarts the amount of lives to the maximum
- Source: