Class TileManager

java.lang.Object
net.vincent.parkourwarrior.TileManager

public class TileManager extends Object
Tile manager class for Parkour Warrior.

This class manages all tiles in the game world, including loading tile images, reading map data from resource files, and drawing the visible tiles on screen relative to the player's position.

Since:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Array of all available tile types.
    int
    The current tile number being processed.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TileManager(ParkourMain parkourMain)
    Constructs a new TileManager with a reference to the main game panel, initializes the tile array and map data array, and loads all tile images.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    drawTile(Graphics2D graphics2D)
    Draws the visible tiles on screen.
    void
    Loads all tile images from the resources and assigns their solid properties.
    void
    Loads map data from the specified resource paths.
    void
    Updates the tile state each frame.

    Methods inherited from class java.lang.Object

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

    • tile

      public Tile[] tile
      Array of all available tile types.
      Since:
      1.0
    • tileNumber

      public int tileNumber
      The current tile number being processed.
      Since:
      1.0
  • Constructor Details

    • TileManager

      public TileManager(ParkourMain parkourMain)
      Constructs a new TileManager with a reference to the main game panel, initializes the tile array and map data array, and loads all tile images.
      Parameters:
      parkourMain - the main game panel instance
      Since:
      1.0
  • Method Details

    • drawTile

      public void drawTile(Graphics2D graphics2D)
      Draws the visible tiles on screen.

      Iterates through the tile map array and renders each tile relative to the player's position using a camera offset.

      Parameters:
      graphics2D - the Graphics2D context to draw on
      Since:
      1.0
    • updateTile

      public void updateTile()
      Updates the tile state each frame.
      Since:
      1.0
    • loadMap

      public void loadMap(ArrayList<String> mapPaths)
      Loads map data from the specified resource paths.

      Reads each map file line by line, parsing space-separated tile numbers into the mapTileNumber array.

      Parameters:
      mapPaths - the list of resource paths to the map files
      Since:
      1.1
    • getTile

      public void getTile()
      Loads all tile images from the resources and assigns their solid properties.
      Since:
      1.0