GodotCourse/scripts/gamecontroller.gd

24 lines
558 B
GDScript3
Raw Normal View History

2024-07-29 22:14:19 +00:00
extends Node2D
2024-07-30 01:07:47 +00:00
var myBox = preload("res://scenes/crate.tscn")
@onready var box_trap = $BoxTrap
2024-07-29 22:14:19 +00:00
# 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
2024-07-30 01:07:47 +00:00
func _on_area_2d_areatrigger(effect, body):
print("Game Controller sees the trigger " + effect)
match effect:
"alert":
for n in 5:
var box = myBox.instantiate()
add_child(box)
box.transform = box_trap.global_transform