static body, rigid body, character body, area2d, gamecontroller, custom signal
This commit is contained in:
1 parent
66f92e9d59
commit
e771dd5a61
10 files changed
+155
No files matched your search
@@ -0,0 +1,21 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_areatrigger(effect, body) -> void:
|
||||
print("Game controller knows about trigger")
|
||||
if effect == "destroy":
|
||||
print("Destroy this thing")
|
||||
body.queue_free()
|
||||
|
||||
if effect == "powerup":
|
||||
print("power up the player")
|
||||
@@ -0,0 +1 @@
|
||||
uid://dflv3rb4v8c0r
|
||||
@@ -0,0 +1,19 @@
|
||||
extends Area2D
|
||||
|
||||
@export var effect = "destroy"
|
||||
|
||||
signal areatrigger(effect, Object)
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
print("Trigger entered")
|
||||
#broadcast to controller
|
||||
areatrigger.emit(effect, body)
|
||||
@@ -0,0 +1 @@
|
||||
uid://ixnbwhm0ptg5
|
||||
Reference in new issue
Block a user