28 lines
659 B
GDScript
28 lines
659 B
GDScript
extends Node2D
|
|
|
|
#preloading crate and marker for box trap
|
|
var myBox = preload("res://scenes/crate.tscn")
|
|
@onready var box_trap = $BoxTrap
|
|
|
|
# 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_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 = myBox.instantiate()
|
|
add_child(box)
|
|
box.transform = box_trap.transform
|