Add animation, Box Trap for Area2D
This commit is contained in:
1 parent
0b64fc5ff8
commit
4be87a6b40
17 files changed
+283
-21
No files matched your search
@@ -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":
|
||||
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")
|
||||
|
||||
Reference in new issue
Block a user