§ Player()
Constructor for the player.
sets the current life is the full life (3).
§ checkLoss()
boolean model.Player.checkLoss |
( |
| ) |
|
checks whether the player loses the game or not
- Returns
- if a player's score is 0 (NOLIFE), return the true to indicate the player loses.
§ decrementLife()
void model.Player.decrementLife |
( |
| ) |
|
loses score if the ball touches his/her border.
decreases the number of life by 1.
§ getScore()
int model.Player.getScore |
( |
| ) |
|
gets the score of a player.
- Returns
- playerScore returns the score of the player.
§ resetScore()
void model.Player.resetScore |
( |
| ) |
|
§ setScore()
void model.Player.setScore |
( |
int |
x | ) |
|
sets the score of the player.
changes the score to the input value.
- Parameters
-
- Exceptions
-
ArithmeticException | score could not be set less than zero |
§ LIFE
final int model.Player.LIFE = 3 |
|
private |
Defines constant number of life of a player
- the player has 3 lives in total
- the player loses if the number of life is 0
§ NOLIFE
final int model.Player.NOLIFE = 0 |
|
private |
§ score
Defines the current number of life of the player.
The documentation for this class was generated from the following file: