box trap working

This commit is contained in:
OddlyTimbot committed 2024-07-29 21:05:41 -04:00
1 parent fcd9c6601f
commit 04d49fee67
25 files changed
+480 -32

No files matched your search

+15 -2
View File
@@ -1,5 +1,7 @@
extends Node2D
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 +13,16 @@ 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.position = box_trap.position
"powerup":
print("you got power")