From 15b477ca7148bbe7f2c8172a69d949cf901057b2 Mon Sep 17 00:00:00 2001 From: CactiChameleon9 <51231053+CactiChameleon9@users.noreply.github.com> Date: Tue, 15 Mar 2022 13:13:44 +0000 Subject: [PATCH] Implement attack_limit for Unit --- src/classes/Unit.gd | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/classes/Unit.gd b/src/classes/Unit.gd index e13a175..f4ec9dc 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 @@ -77,7 +78,7 @@ func move(movement : Vector2): z_index = 100 -func attack(damage : float, points : int, pattern : PoolVector2Array): #TODO +func attack(damage : int, points : int, pattern : PoolVector2Array): #TODO if attack_points != 0: #change animation to attacking $AnimationPlayer.play("Attack front") @@ -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