class_name GameController extends Node2D var totalCrates = 10 var timeLimit = 4 var timer = Timer.new() # Called when the node enters the scene tree for the first time. func _ready() -> void: add_child(timer) timer.wait_time = 1 timer.one_shot = false timer.connect("timeout", secondCounter) timer.start()# Replace with function body. func secondCounter(): print("tick") timeLimit -=1 if timeLimit <= 0: print ("YOU LOSE") # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass func _on_trigger_fired(effect: Variant, body: Variant) -> void: print("GameController knows :: "+effect) if effect=="destroy": totalCrates -=1 print("Crates Remaining"+str(totalCrates))# Replace with function body. body.queue_free() if totalCrates==0: print("YOU WIN") get_tree().reload_current_scene() func numberOfCrates(value): totalCrates = value print ("Total crates at GC: "+str(totalCrates)) func bulletDamage(body, bullet): print ("game controller knows about bullet hit")