24 lines
508 B
GDScript
24 lines
508 B
GDScript
extends Node2D
|
|
|
|
var crateTotal = 3
|
|
|
|
# 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(body: Variant, effect) -> void:
|
|
print("GC knows trigger...."+effect)
|
|
if body is Crate:
|
|
match effect:
|
|
"destroy":
|
|
crateTotal -=1
|
|
if crateTotal <=0:
|
|
print("You WON!!!")
|
|
body.queue_free()
|