Files
shadow-pixel-run/scripts/actors/character.gd
T

27 lines
854 B
GDScript
Raw Normal View History

## 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()