Class TileManager

java.lang.Object
dev.kyzel.game.world.tile.TileManager

public class TileManager extends Object
A class to manage the tiles in the game.
  • Field Details

    • render

      protected Renderer render
      The Renderer where the all the tiles will be drawn on.
    • game

      protected Game game
      The Game where the all the tiles' information will write to.
    • maxRow

      protected int maxRow
      The max number of rows of the tiles list.
    • maxCol

      protected int maxCol
      The max number of columns of the tiles list.
    • numberWorldTile

      private double[][] numberWorldTile
      The list of number which is used to generate the map.
    • worldTiles

      protected Tile[][] worldTiles
      The list of all tiles.
  • Constructor Details

    • TileManager

      public TileManager(Renderer render, Game game)
      Creates a new TileManager.
      Parameters:
      render - the Renderer where the all the tiles will be drawn on
      game - the Game where the all the tiles' information will write to
  • Method Details

    • getWorldTiles

      public Tile[][] getWorldTiles()
      Gets a list of all tiles.
      Returns:
      an array of all tiles
    • getMaxRow

      public int getMaxRow()
      Gets the max number of rows of the tiles list.
      Returns:
      the max number of rows of the tiles list.
    • getMaxCol

      public int getMaxCol()
      Gets the max number of columns of the tiles list.
      Returns:
      the max number of columns of the tiles list.
    • getTile

      public Tile getTile(int x, int y)
      Attempts to get a tile in the tiles list.
      Parameters:
      x - the x coordinate of the tile
      y - the y coordinate of the tile
      Returns:
      the tile if the given values are in range, null otherwise
    • loadAllTexture

      public void loadAllTexture()
      Loads all tiles into the game.
    • drawAllTexture

      public void drawAllTexture(Graphics g)
      Draws all the visible tiles.
      Parameters:
      g - the Graphics which is used to draw