GodotCourse/week4/updated_project/scripts/gamecontroller.gd
2024-08-04 18:53:22 -04:00

19 lines
433 B
GDScript

extends Node2D
var crate = preload("res://scenes/crate.tscn")
@onready var boxtrap = $crates/boxtrap
func _on_area_2d_areatrigger(effect, body):
print("Game Controller sees the trigger "+effect)
match effect:
"alert":
#do stuff
print("hi")
if body.is_in_group("player"):
for n in 3:
var box = crate.instantiate()
add_child(box)
box.position = boxtrap.position
"powerup":
print("you got power")