- 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.
27 lines
854 B
GDScript
27 lines
854 B
GDScript
## Character.gd
|
|
# Base class for all turn-based characters (player, enemies, etc.)
|
|
# Handles registration with TurnManager and provides a turn interface.
|
|
class_name Character
|
|
extends CharacterBody2D
|
|
|
|
# Signal emitted when this character's turn is finished.
|
|
signal turn_finished
|
|
|
|
# Called by TurnManager to let this character take its turn.
|
|
# Subclasses should override this to implement their own turn logic.
|
|
func take_turn() -> void:
|
|
# Virtual method to be overridden by subclasses
|
|
pass
|
|
|
|
# Called when the node enters the scene tree.
|
|
# Registers this character with the TurnManager for turn order.
|
|
func _ready() -> void:
|
|
if Engine.is_editor_hint():
|
|
return
|
|
TurnManager.register_entity(self)
|
|
|
|
# Call this to remove the character from the turn system and free it from the scene.
|
|
func die() -> void:
|
|
TurnManager.unregister_entity(self)
|
|
queue_free()
|