summaryrefslogtreecommitdiff
path: root/Scripts/GameLoop.gd
blob: 04cd370590cd3a06bff25496f5377812e837e281 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
extends Node
class_name GameLoop

@export var turns : int
@export var label : Label
var current_turns : int = 0
var prev_turn : int = -1

# Called when the node enters the scene tree for the first time.
func _ready():
	GlobalVariables.gameloop = self

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)
		GlobalVariables.ai.step()