GodotCourse/week4/updated_project/scripts/gamecontroller.gd

19 lines
433 B
GDScript3
Raw Normal View History

2024-07-29 18:33:53 +00:00
extends Node2D
2024-08-04 22:53:22 +00:00
var crate = preload("res://scenes/crate.tscn")
@onready var boxtrap = $crates/boxtrap
2024-07-29 18:33:53 +00:00
2024-08-04 22:53:22 +00:00
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")