FaultInOurPong  1
model.Player Class Reference

Public Member Functions

 Player ()
 Constructor for the player. More...
 
void decrementLife ()
 loses score if the ball touches his/her border. More...
 
int getScore ()
 gets the score of a player More...
 
void setScore (int x)
 
boolean checkLoss ()
 checks whether the player loses the game or not More...
 
void resetScore ()
 

Private Attributes

final int LIFE = 3
 
final int NOLIFE = 0
 
int score
 

Constructor & Destructor Documentation

§ Player()

model.Player.Player ( )

Constructor for the player.

sets the current life is the full life (3).

Member Function Documentation

§ checkLoss()

boolean model.Player.checkLoss ( )

checks whether the player loses the game or not

Returns
a boolean that is used to indicate whether the player is losing or not

§ 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)

Member Data Documentation

§ 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

int model.Player.score
private

Defines the current number of life of the player.


The documentation for this class was generated from the following file: