From 8c5c4863aeacb4afcf70f339df6d601e2df1a7a6 Mon Sep 17 00:00:00 2001 From: bd Date: Thu, 22 May 2025 13:50:49 -0400 Subject: Reorganized files into scenes and scripts --- scripts/game_data.gd | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 scripts/game_data.gd (limited to 'scripts/game_data.gd') diff --git a/scripts/game_data.gd b/scripts/game_data.gd new file mode 100644 index 0000000..fd6a80e --- /dev/null +++ b/scripts/game_data.gd @@ -0,0 +1,29 @@ + +extends Node + +signal life_changed +signal morale_changed +var _life: int = 20 +var _morale: int = 10 + +func get_life() -> int: + return _life + +func add_life(amount: int): + _life += amount + emit_signal("life_changed", _life) + +func subtract_life(amount: int): + _life -= amount + emit_signal("life_changed", _life) + +func get_morale() -> int: + return _morale + +func add_morale(amount: int): + _morale += amount + emit_signal("morale_changed", _morale) + +func subtract_morale(amount: int): + _morale -= amount + emit_signal("life_changed", _morale) -- cgit v1.2.3