Class GameObject

java.lang.Object
com.edu.xmum.CST210.Model.AbstractClass.GameObject
Direct Known Subclasses:
AiModel, MazeModel, PlayerModel

public abstract class GameObject extends Object
The superclass of all objects in the game. Specifies properties that all game objects should have: 1. Horizontal coordinate: x 2. Vertical coordinate: y

Specifies the methods that all game objects should have: 1. Getter and setter methods for x and y coordinates

  • Constructor Summary

    Constructors
    Constructor
    Description
    GameObject(int x, int y)
    Constructor to initialize the coordinates of the game object.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the horizontal coordinate.
    int
    Gets the vertical coordinate.
    void
    setX(int x)
    Sets the horizontal coordinate.
    void
    setY(int y)
    Sets the vertical coordinate.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GameObject

      public GameObject(int x, int y)
      Constructor to initialize the coordinates of the game object.
      Parameters:
      x - The horizontal coordinate.
      y - The vertical coordinate.
  • Method Details

    • getX

      public int getX()
      Gets the horizontal coordinate.
      Returns:
      The x-coordinate.
    • setX

      public void setX(int x)
      Sets the horizontal coordinate.
      Parameters:
      x - The x-coordinate.
    • getY

      public int getY()
      Gets the vertical coordinate.
      Returns:
      The y-coordinate.
    • setY

      public void setY(int y)
      Sets the vertical coordinate.
      Parameters:
      y - The y-coordinate.