Class Tile

java.lang.Object
dev.kyzel.game.world.tile.Tile
Direct Known Subclasses:
AnimatedTile

public class Tile extends Object
The tile class.
  • Field Details

    • render

      protected Renderer render
      The Renderer where the tile will be drawn on.
    • tileName

      protected String tileName
      The tile's name.
    • isSolid

      protected boolean isSolid
      A variable to see if the tile is solid.
    • x

      protected int x
      The x coordinate of the tile.
    • y

      protected int y
      The y coordinate of the tile.
    • tileImage

      protected BufferedImage tileImage
      The texture of the tile.
  • Constructor Details

    • Tile

      public Tile(Renderer render, int x, int y, String tileName, boolean isSolid)
      Creates a new tile.
      Parameters:
      render - the Renderer where the tile will be drawn on
      x - the x coordinate of the tile
      y - the y coordinate of the tile
      tileName - the tile's name
      isSolid - is the tile solid
  • Method Details

    • getX

      public int getX()
      Gets the x coordinate of the tile.
      Returns:
      the x coordinate of the tile
    • setX

      public void setX(int x)
      Set the x coordinate of the tile to the given value.
      Parameters:
      x - the given value
    • getY

      public int getY()
      Gets the y coordinate of the tile.
      Returns:
      the y coordinate of the tile
    • setY

      public void setY(int y)
      Set the y coordinate of the tile to the given value.
      Parameters:
      y - the given value
    • draw

      public void draw(Graphics g)
      Draws the tile.
      Parameters:
      g - the Graphics which is used to draw
    • isSolid

      public boolean isSolid()
      Checks if the tile is solid.
      Returns:
      if the tile is solid
    • getTileName

      public String getTileName()
      Gets the tile's name.
      Returns:
      the tile's name
    • setTileName

      public void setTileName(String tileName)
      Set the tile's name to the given value.
      Parameters:
      tileName - the given value
    • getTileImage

      public BufferedImage getTileImage()
      Get the texture of the tile.
      Returns:
      the texture of the tile
    • setTileImage

      public void setTileImage(BufferedImage tileImage)
      Set the texture of the tile to the given image.
      Parameters:
      tileImage - the given image