Class Tile

  • All Implemented Interfaces:
    Locatable

    public class Tile
    extends java.lang.Object
    implements Locatable
    • Constructor Summary

      Constructors 
      Constructor Description
      Tile()  
      Tile​(int x, int y)  
      Tile​(int x, int y, int z)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Tile clone()  
      double distance()
      Gets the distance between the current Tile and your player.
      double distance​(Tile tile)
      Gets the distance between the current Tile and specified Tile
      double distance​(Entity entity)
      Gets the distance of the current Tile to the Entity
      boolean equals​(java.lang.Object obj)  
      Area getArea​(int radius)  
      int getGridX()
      Gets grid (local) X coordinate of the given object.
      int getGridY()
      Gets grid (local) Y coordinate of the given object.
      java.awt.Polygon getPolygon()  
      Tile getRandomizedTile()  
      Tile getRandomizedTile​(int deviation)  
      Tile getTile()
      Gets tile of the object.
      TileReference getTileReference()
      Gets tile reference of the given object.
      int getX()
      Gets the X coordinate of the Tile
      int getY()
      Gets the Y coordinate of the Tile
      int getZ()
      Gets the Z coordinate of the tile
      int hashCode()  
      void setX​(int x)
      Sets the X coordinate for a Tile
      void setY​(int y)
      Sets the Y coordinate of the Tile
      void setZ​(int z)
      Sets the Z coordinate of the tile
      java.lang.String toString()  
      Tile translate​(int x, int y)
      Translates this Tile's location by the specified amount and returns then this Tile with the updated location.
      Tile translate​(Tile tile)
      Translates this Tile's location by the specified amount and returns then this Tile with the updated location.
      double walkingDistance​(Tile tile)
      Walking distance based on path finding away from the given tile.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Tile

        public Tile()
      • Tile

        public Tile​(int x,
                    int y)
      • Tile

        public Tile​(int x,
                    int y,
                    int z)
    • Method Detail

      • translate

        public Tile translate​(Tile tile)
        Translates this Tile's location by the specified amount and returns then this Tile with the updated location.
        Parameters:
        tile - the tile which to translate.
        Returns:
        this tile with the translated location.
      • translate

        public Tile translate​(int x,
                              int y)
        Translates this Tile's location by the specified amount and returns then this Tile with the updated location.
        Parameters:
        x - x by which to translate.
        y - y by which to translate.
        Returns:
        this tile with the translated location.
      • getX

        public int getX()
        Gets the X coordinate of the Tile
        Specified by:
        getX in interface Locatable
        Returns:
        X coordinate of Tile
      • setX

        public void setX​(int x)
        Sets the X coordinate for a Tile
        Parameters:
        x - X coordinate
      • getY

        public int getY()
        Gets the Y coordinate of the Tile
        Specified by:
        getY in interface Locatable
        Returns:
        Y coordinate of the tile
      • setY

        public void setY​(int y)
        Sets the Y coordinate of the Tile
        Parameters:
        y - Y coordinate
      • getGridX

        public int getGridX()
        Description copied from interface: Locatable
        Gets grid (local) X coordinate of the given object.
        Specified by:
        getGridX in interface Locatable
        Returns:
        the grid X coordinate of the object.
      • getGridY

        public int getGridY()
        Description copied from interface: Locatable
        Gets grid (local) Y coordinate of the given object.
        Specified by:
        getGridY in interface Locatable
        Returns:
        the grid Y coordinate of the object.
      • getZ

        public int getZ()
        Gets the Z coordinate of the tile
        Specified by:
        getZ in interface Locatable
        Returns:
        Z coordinate
      • setZ

        public void setZ​(int z)
        Sets the Z coordinate of the tile
        Parameters:
        z - Z coordinate
      • getTileReference

        public TileReference getTileReference()
        Description copied from interface: Locatable
        Gets tile reference of the given object.
        Specified by:
        getTileReference in interface Locatable
        Returns:
        the object tile reference.
      • distance

        public double distance​(Entity entity)
        Gets the distance of the current Tile to the Entity
        Parameters:
        entity - Entity to check
        Returns:
        Distance between Tile and Entity
      • clone

        public Tile clone()
      • getTile

        public Tile getTile()
        Description copied from interface: Locatable
        Gets tile of the object.
        Specified by:
        getTile in interface Locatable
        Returns:
        the object tile.
      • distance

        public double distance​(Tile tile)
        Gets the distance between the current Tile and specified Tile
        Specified by:
        distance in interface Locatable
        Parameters:
        tile - the tile to check distance from.
        Returns:
        from the given location.
      • walkingDistance

        public double walkingDistance​(Tile tile)
        Description copied from interface: Locatable
        Walking distance based on path finding away from the given tile. This is more expensive of a call than distance, and should be used sparingly.
        Specified by:
        walkingDistance in interface Locatable
        Parameters:
        tile - the destination tile.
        Returns:
        return the path distance movement cost from the given tile as a double. If there isn't a path to the tile, it will return 3 times the as the crow flies distance.
      • getPolygon

        public java.awt.Polygon getPolygon()
      • distance

        public double distance()
        Gets the distance between the current Tile and your player.
        Returns:
        from the given location.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getRandomizedTile

        public Tile getRandomizedTile()
      • getRandomizedTile

        public Tile getRandomizedTile​(int deviation)
      • getArea

        public Area getArea​(int radius)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object