Package com.edu.xmum.CST210.Model.Entity
Class PlayerModel
java.lang.Object
com.edu.xmum.CST210.Model.AbstractClass.GameObject
com.edu.xmum.CST210.Model.Entity.PlayerModel
- All Implemented Interfaces:
IPlayerModel
PlayerModel class representing a player in the game.
This class extends the GameObject class and implements the IPlayerModel interface.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerModel(IMazeModel mazeModel) Constructor to initialize the PlayerModel with the starting position based on the maze model. -
Method Summary
Modifier and TypeMethodDescriptionintGets the starting x-coordinate of the player model.intGets the starting y-coordinate of the player model.voidmove(int dx, int dy) Moves the player model by the specified delta values.voidsetPosition(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, setYMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.edu.xmum.CST210.Model.Interface.IPlayerModel
getX, getY
-
Constructor Details
-
PlayerModel
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:
getStartXin interfaceIPlayerModel- Returns:
- The starting x-coordinate.
-
getStartY
public int getStartY()Gets the starting y-coordinate of the player model.- Specified by:
getStartYin interfaceIPlayerModel- Returns:
- The starting y-coordinate.
-
move
public void move(int dx, int dy) Moves the player model by the specified delta values.- Specified by:
movein interfaceIPlayerModel- 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:
setPositionin interfaceIPlayerModel- Parameters:
x- The x-coordinate to set.y- The y-coordinate to set.
-