Class Tile

java.lang.Object
com.deco2800.game.entities.Tile

public class Tile extends Object
Class representing a 'Tile' in the game world. Only one entity can occupy any one tile at any point in time. Provides methods for getting and setting Tiles.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new Tile object and initialises it with default values.
    Tile(Entity entity)
    Creates a new Tile object and initialises it with a given Entity
    Tile(String tileType)
    Creates a new Tile object and initialises it with a given tileType
    Tile(String tileType, Entity entity)
    Creates a new Tile object and initialises it with the provided values for tileType and entity
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Sets the Tile's entity parameter to null.
    Returns the entity contained by the tile or null if none present
    Returns the tile's type
    void
    setEntity(Entity entity)
    Sets the entity parameter of the tile
    void
    setTileType(String tileType)
    Sets the tileType parameter of the tile

    Methods inherited from class java.lang.Object

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

    • Tile

      public Tile()
      Creates a new Tile object and initialises it with default values.
    • Tile

      public Tile(String tileType)
      Creates a new Tile object and initialises it with a given tileType
      Parameters:
      tileType - string
    • Tile

      public Tile(Entity entity)
      Creates a new Tile object and initialises it with a given Entity
      Parameters:
      entity -
    • Tile

      public Tile(String tileType, Entity entity)
      Creates a new Tile object and initialises it with the provided values for tileType and entity
      Parameters:
      tileType - string
      entity - Entity
  • Method Details

    • setTileType

      public void setTileType(String tileType)
      Sets the tileType parameter of the tile
      Parameters:
      tileType - string
    • setEntity

      public void setEntity(Entity entity)
      Sets the entity parameter of the tile
      Parameters:
      entity -
    • getTileType

      public String getTileType()
      Returns the tile's type
      Returns:
      string
    • getEntity

      public Entity getEntity()
      Returns the entity contained by the tile or null if none present
      Returns:
      Entity
    • clearTile

      public void clearTile()
      Sets the Tile's entity parameter to null.