java.lang.Object
project.pong.model.Player
The Player class represents a player in the Pong game.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()Gets the name of the player.Gets the racket associated with the player.intgetScore()Gets the score of the player.voidIncreases the score of the player by 1.voidSets the name of the player.voidSets the racket associated with the player.voidsetScore(int score) Sets the score of the player.
-
Constructor Details
-
Player
Constructs a Player object with the specified parameters.- Parameters:
racket- The racket associated with the player.name- The name of the player.side- The side of the player (LEFT or RIGHT).
-
-
Method Details
-
getRacket
Gets the racket associated with the player.- Returns:
- The racket associated with the player.
-
setRacket
Sets the racket associated with the player.- Parameters:
racket- The racket to set.
-
getScore
public int getScore()Gets the score of the player.- Returns:
- The score of the player.
-
setScore
public void setScore(int score) Sets the score of the player.- Parameters:
score- The score to set.
-
increaseScore
public void increaseScore()Increases the score of the player by 1. -
getName
Gets the name of the player.- Returns:
- The name of the player.
-
setName
Sets the name of the player.- Parameters:
name- The name to set.
-