June2026Game/scripts/scene_manager.gd
2026-06-22 21:03:05 -04:00

21 lines
523 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 game controller how many crates
var totalCrates = 0
if crates:
for obj in crates.get_children():
if obj is Crate:
totalCrates += 1
game.crateTotal(totalCrates)