Solo_Week2_June2026Game/Scripts/scene_manager.gd
2026-06-22 21:04:23 -04:00

23 lines
573 B
GDScript

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)