Class Entity

java.lang.Object
edu.uoc.pacman.model.entities.Entity
Direct Known Subclasses:
Character, MapItem

public abstract class Entity extends Object
Represents any item that appears in the game.
  • Field Details

    • position

      private Position position
      Position where the entity is.
    • pathable

      private boolean pathable
      Indicates if the entity is pathable or not.
    • sprite

      private Sprite sprite
      Value of Sprite linked to the entity.
  • Constructor Details

    • Entity

      protected Entity(Position position, boolean pathable, Sprite sprite)
      Constructor with arguments.
      Parameters:
      position - Initial value of the attribute position.
      pathable - Initial value of the attribute pathable.
      sprite - Initial value of the attribute sprite.
  • Method Details

    • getPosition

      public Position getPosition()
      Gets the current position of the entity.
      Returns:
      current position.
    • setPosition

      public void setPosition(Position position)
      Sets the position of the entity. If position is null, then the position is not set.
      Parameters:
      position - to set to the entity
    • isPathable

      public boolean isPathable()
      Getter of the attribute pathable.
      Returns:
      Current value of pathable.
    • setPathable

      public void setPathable(boolean pathable)
      Setter of the attribute pathable.
      Parameters:
      pathable - New value for the attribute pathable.
    • getSprite

      public Sprite getSprite()
      Getter of the attribute sprite.
      Returns:
      Current value of sprite.
    • setSprite

      protected void setSprite(Sprite sprite)
      Setter of the attribute sprite.
      Parameters:
      sprite - New value for the attribute sprite.