Package org.vyang.parkourwarrior
Class TileManager
java.lang.Object
org.vyang.parkourwarrior.TileManager
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
FieldsModifier and TypeFieldDescriptionTile[]Array of all available tile types.intThe current tile number being processed. -
Constructor Summary
ConstructorsConstructorDescriptionTileManager(ParkourMain parkourMain) Constructs a newTileManagerwith a reference to the main game panel, initializes the tile array and map data array, and loads all tile images. -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawTile(Graphics2D graphics2D) Draws the visible tiles on screen.voidgetTile()Loads all tile images from the resources and assigns their solid properties.voidloadMap()Loads map data from the specified resource paths.voidUpdates the tile state each frame.
-
Field Details
-
tile
Array of all available tile types.- Since:
- 1.0
-
tileNumber
public int tileNumberThe current tile number being processed.- Since:
- 1.0
-
-
Constructor Details
-
TileManager
Constructs a newTileManagerwith 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
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- theGraphics2Dcontext to draw on- Since:
- 1.0
-
updateTile
public void updateTile()Updates the tile state each frame.- Since:
- 1.0
-
loadMap
public void loadMap()Loads map data from the specified resource paths.Reads each map file line by line, parsing space-separated tile numbers into the
mapTileNumberarray.- Since:
- 1.1
-
getTile
public void getTile()Loads all tile images from the resources and assigns their solid properties.- Since:
- 1.0
-