Implement attack_limit for Unit

This commit is contained in:
CactiChameleon9 2022-03-14 08:02:16 +00:00
parent 1d30a03966
commit 826418c68f

View File

@ -6,6 +6,7 @@ export var unit_type : String
export var max_health : int = 10 export var max_health : int = 10
export var health : int = 10 export var health : int = 10
export var movement_distance : int = 10 export var movement_distance : int = 10
export var attack_limit : int = 20
export var height : int = 0 export var height : int = 0
export var water_walk : bool = false export var water_walk : bool = false
export var air_walk : bool = false export var air_walk : bool = false
@ -26,7 +27,7 @@ onready var Grid = get_node("../Grid")
func start_turn(): func start_turn():
attack_points = 0 attack_points = attack_limit
movement_points = movement_distance movement_points = movement_distance
_has_sent_turn_completed = false _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.x = move_toward(position.x, _target_position.x, 800 * delta)
position.y = move_toward(position.y, _target_position.y, 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: if attack_points == 0 && movement_points == 0 && not _has_sent_turn_completed:
emit_signal("turn_completed") emit_signal("turn_completed")
_has_sent_turn_completed = true _has_sent_turn_completed = true