Package com.csse3200.game.minigames
Class GridCell
java.lang.Object
com.csse3200.game.minigames.GridCell
Represents a single cell on the grid.
A cell has a fixed position (x, y) and can be either occupied or unoccupied.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
getX()
get the cells x coordinateint
getY()
get the cells y coordinateboolean
Returns a booleean if the cell is occupiedvoid
setOccupied
(boolean occupied) Sets a cells occupied status
-
Constructor Details
-
GridCell
public GridCell(int x, int y) Creates a new GridCell at the specified coordinates. The cell is initially unoccupied.- Parameters:
x
- The x-coordinate of the cell.y
- The y-coordinate of the cell.
-
-
Method Details
-
getX
public int getX()get the cells x coordinate- Returns:
- x coordinate
-
getY
public int getY()get the cells y coordinate- Returns:
- y coordinate
-
isOccupied
public boolean isOccupied()Returns a booleean if the cell is occupied- Returns:
- true if occupied, otherwise false
-
setOccupied
public void setOccupied(boolean occupied) Sets a cells occupied status- Parameters:
occupied
- : the status to set occupied to
-