extends Node2D # hold control and drag + drop @onready var game: Node2D = $".." @onready var crates: Node2D = $"../Crates" # Called when the node enters the scene tree for the first time. func _ready() -> void: buildLevel() # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass func buildLevel() -> void: # Tell GC how many crates var totalCrates = 0 # check if any crates in scene if crates: for obj in crates.get_children(): if obj is Crate: totalCrates += 1 game.crateTotal(totalCrates)