box trapgit add .!

This commit is contained in:
mitchellgunn committed 2024-07-29 21:01:19 -04:00
1 parent 1b1b89fa5b
commit a17c4a93b1
19 files changed
+314 -33

No files matched your search

+14 -2
View File
@@ -1,5 +1,8 @@
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():
@@ -11,5 +14,14 @@ func _process(delta):
pass
func _on_area_2d_areatrigger(effect, Object):
print("Game Controller sees the trigger")
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