FebruaryGame/februarygodotgame/scripts/gamecontroller.gd
2025-02-24 21:10:17 -05:00

26 lines
533 B
GDScript

extends Node2D
#Game Data
var totalCrates = 2
var cratesDestroyed = 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_trigger_area_trigger(body) -> void:
print("Game controller knows about crate destruction")
cratesDestroyed +=1
totalCrates -=1
# kill em
body.queue_free()
if totalCrates <=0:
print("you won")