feat: Add core map generation and management system

- Introduced MapData, MapGenerator, and MapPainter classes for procedural map generation.
- Implemented LevelManager to handle level initialization and navigation.
- Created TurnManager for managing turn order in a turn-based system.
- Added Player and Enemy character classes with movement and turn-taking capabilities.
- Established pathfinding using AStar2D in PathfindingHandler.
- Integrated new scenes for player and enemy characters, along with world setup.
- Included a new tileset for futuristic Zelda-themed assets.
This commit is contained in:
2026-03-16 16:24:32 +11:00
parent f5e33fb8ea
commit bb1c9f9284
39 changed files with 2341 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
## MapData.gd
# Resource class that stores all data for a generated map, including tile types, rooms, and spawn points.
class_name MapData
extends Resource
# Enum for all possible tile types in the map grid.
# Used to distinguish between empty space, walkable floor, walls, doors, and stairs.
enum TileType {
VOID, # Unused/empty space
FLOOR, # Walkable floor tile
WALL, # Solid wall tile
DOOR, # Door tile (can be opened/closed)
STAIRS # Stairs tile (for level transitions)
}
# The main grid: Dictionary mapping Vector2i coordinates to TileType values.
# This is the authoritative source for the map's layout.
@export var grid: Dictionary = {}
# The number of rooms generated for this map (set during generation).
@export var room_count: int = 0
# List of all room rectangles (Rect2i) in the map, used for spawning and logic.
@export var rooms: Array[Rect2i] = []
# The starting position for the player (in grid coordinates).
@export var spawn_point: Vector2i = Vector2i.ZERO
# Returns true if the tile at 'coords' is of the given TileType.
# Used for pathfinding and logic checks.
func is_tile_type(coords: Vector2i, type: TileType) -> bool:
return grid.get(coords, TileType.VOID) == type
# Clears all map data so this resource can be reused for a new map.
func clear() -> void:
grid.clear()
rooms.clear()
room_count = 0
spawn_point = Vector2i.ZERO