Files
Sept26Game/scripts/gamecontroller.gd
T

32 lines
808 B
GDScript
Raw Normal View History

2026-10-06 19:44:18 -04:00
class_name GameController extends Node2D
2026-10-13 20:58:42 -04:00
signal teleportSignal(body:RigidBody2D)
signal destroySignal(body)
2026-10-06 19:44:18 -04:00
# 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_trigger(effect: Variant, Object: Variant) -> void:
2026-10-06 19:44:18 -04:00
print("GC knows about trigger: " + effect)
match effect:
"destroy":
if not Object is Player:
2026-10-13 20:58:42 -04:00
destroySignal.emit(Object)
2026-10-06 19:44:18 -04:00
"teleport":
print("Trigger wants to teleport")
if Object is Crate:
teleportSignal.emit(Object)
2026-10-06 20:58:01 -04:00
func _on_bullet_hit(body, bullet) -> void:
print("GC knows bullet hit")
if body is Crate:
2026-10-13 20:58:42 -04:00
destroySignal.emit(body)
destroySignal.emit(bullet)
2026-10-06 20:58:01 -04:00