diff options
author | altaf-creator <dev@altafcreator.com> | 2024-04-14 23:00:45 +0700 |
---|---|---|
committer | altaf-creator <dev@altafcreator.com> | 2024-04-14 23:00:45 +0700 |
commit | f1b4d6034c937c89b2750bc209684a4e19896177 (patch) | |
tree | f91731656ff901e458ab504b8e8e33fb06e67c0b /Scripts/GameLoop.gd | |
parent | 21d3893b6b1c1ffb2d9611bce67568e713161b3d (diff) |
Art overhaul
Diffstat (limited to 'Scripts/GameLoop.gd')
-rw-r--r-- | Scripts/GameLoop.gd | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Scripts/GameLoop.gd b/Scripts/GameLoop.gd index e5cf08e..6b71faf 100644 --- a/Scripts/GameLoop.gd +++ b/Scripts/GameLoop.gd @@ -3,7 +3,9 @@ class_name GameLoop @export var turns : int @export var label : Label +@export var turn_label : Label @export_file var level : String +@export var can_play : bool = true var current_turns : int = 0 var prev_turn : int = -1 @@ -14,13 +16,19 @@ func _ready(): current_turns = 0 func _process(_delta): - if current_turns >= turns: - label.text = "FINISHED!" - if prev_turn != current_turns: prev_turn = current_turns - label.text = "Turns Left: " + str(turns - current_turns) - if current_turns != 0: GlobalVariables.ai.step() + label.text = str(turns - current_turns) + if current_turns != 0: + can_play = false + turn_label.text = "ai's turn..." + $"BetweenPlayerAndAI".start() if Input.is_action_just_pressed("reset"): get_tree().change_scene_to_file(level) + +func _on_between_player_and_ai_timeout(): + GlobalVariables.ai.step() + can_play = true + if current_turns < turns: turn_label.text = "your turn!" + else: turn_label.text = "" |