Class PlayerModel

java.lang.Object
com.edu.xmum.CST210.Model.AbstractClass.GameObject
com.edu.xmum.CST210.Model.Entity.PlayerModel
All Implemented Interfaces:
IPlayerModel

public class PlayerModel extends GameObject implements IPlayerModel
PlayerModel class representing a player in the game. This class extends the GameObject class and implements the IPlayerModel interface.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor to initialize the PlayerModel with the starting position based on the maze model.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the starting x-coordinate of the player model.
    int
    Gets the starting y-coordinate of the player model.
    void
    move(int dx, int dy)
    Moves the player model by the specified delta values.
    void
    setPosition(int x, int y)
    Sets the position of the player model to the specified coordinates.

    Methods inherited from class com.edu.xmum.CST210.Model.AbstractClass.GameObject

    getX, getY, setX, setY

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.edu.xmum.CST210.Model.Interface.IPlayerModel

    getX, getY
  • Constructor Details

    • PlayerModel

      public PlayerModel(IMazeModel mazeModel)
      Constructor to initialize the PlayerModel with the starting position based on the maze model.
      Parameters:
      mazeModel - The maze model containing the maze structure and start position.
  • Method Details

    • getStartX

      public int getStartX()
      Gets the starting x-coordinate of the player model.
      Specified by:
      getStartX in interface IPlayerModel
      Returns:
      The starting x-coordinate.
    • getStartY

      public int getStartY()
      Gets the starting y-coordinate of the player model.
      Specified by:
      getStartY in interface IPlayerModel
      Returns:
      The starting y-coordinate.
    • move

      public void move(int dx, int dy)
      Moves the player model by the specified delta values.
      Specified by:
      move in interface IPlayerModel
      Parameters:
      dx - The delta x value.
      dy - The delta y value.
    • setPosition

      public void setPosition(int x, int y)
      Sets the position of the player model to the specified coordinates.
      Specified by:
      setPosition in interface IPlayerModel
      Parameters:
      x - The x-coordinate to set.
      y - The y-coordinate to set.