Class GridCell

java.lang.Object
com.csse3200.game.minigames.GridCell

public class GridCell extends Object
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
    Constructor
    Description
    GridCell(int x, int y)
    Creates a new GridCell at the specified coordinates.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    get the cells x coordinate
    int
    get the cells y coordinate
    boolean
    Returns a booleean if the cell is occupied
    void
    setOccupied(boolean occupied)
    Sets a cells occupied status

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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