26 lines
477 B
GDScript3
26 lines
477 B
GDScript3
|
|
extends Node2D
|
||
|
|
|
||
|
|
var createTotal = 3
|
||
|
|
|
||
|
|
|
||
|
|
# Called when the node enters the scene tree for the first time.
|
||
|
|
func _ready():
|
||
|
|
pass # Replace with function body.
|
||
|
|
|
||
|
|
|
||
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
|
func _process(delta):
|
||
|
|
pass
|
||
|
|
|
||
|
|
|
||
|
|
func _on_trigger(body, effect):
|
||
|
|
print("GC knows trigger...." + effect)
|
||
|
|
if body is Create:
|
||
|
|
match effect:
|
||
|
|
"destroy":
|
||
|
|
createTotal -= 1
|
||
|
|
if createTotal <= 0:
|
||
|
|
print("You won")
|
||
|
|
body.queue_free()
|
||
|
|
|