June2026Game/scripts/scene_manager.gd

24 lines
513 B
GDScript

extends Node2D
@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
if crates:
for obj in crates.get_children():
if obj is Crate:
totalCrates +=1
game.crateTotal(totalCrates)