From 826418c68fba0849bd513b794883177f0410aeb7 Mon Sep 17 00:00:00 2001 From: CactiChameleon9 <51231053+CactiChameleon9@users.noreply.github.com> Date: Mon, 14 Mar 2022 08:02:16 +0000 Subject: [PATCH] Implement attack_limit for Unit --- src/classes/Unit.gd | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/classes/Unit.gd b/src/classes/Unit.gd index e13a175..95cb90e 100644 --- a/src/classes/Unit.gd +++ b/src/classes/Unit.gd @@ -6,6 +6,7 @@ export var unit_type : String export var max_health : int = 10 export var health : int = 10 export var movement_distance : int = 10 +export var attack_limit : int = 20 export var height : int = 0 export var water_walk : bool = false export var air_walk : bool = false @@ -26,7 +27,7 @@ onready var Grid = get_node("../Grid") func start_turn(): - attack_points = 0 + attack_points = attack_limit movement_points = movement_distance _has_sent_turn_completed = false @@ -105,8 +106,6 @@ func _physics_process(delta: float) -> void: position.x = move_toward(position.x, _target_position.x, 800 * delta) position.y = move_toward(position.y, _target_position.y, 800 * delta) - attack_points = false - if attack_points == 0 && movement_points == 0 && not _has_sent_turn_completed: emit_signal("turn_completed") _has_sent_turn_completed = true