Module project.pong

Class Player

java.lang.Object
project.pong.model.Player

public class Player extends Object
The Player class represents a player in the Pong game.
  • Constructor Details

    • Player

      public Player(Racket racket, String name, Side side)
      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

      public Racket getRacket()
      Gets the racket associated with the player.
      Returns:
      The racket associated with the player.
    • setRacket

      public void setRacket(Racket racket)
      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

      public String getName()
      Gets the name of the player.
      Returns:
      The name of the player.
    • setName

      public void setName(String name)
      Sets the name of the player.
      Parameters:
      name - The name to set.