JulyGame/scripts/gamecontroller.gd

30 lines
730 B
GDScript3
Raw Permalink Normal View History

extends Node2D
2025-08-19 01:05:53 +00:00
signal playerDamage
# 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
2025-08-12 01:03:02 +00:00
func _on_area_2d_area_trigger_signal(effect: String, body: Node2D) -> void:
if body.name == "world-boundary":
return
2025-08-19 01:05:53 +00:00
if body is Player && effect == "player_hurt":
playerDamage.emit()
body.health -= 1
print(body.health)
2025-08-12 01:03:02 +00:00
return
print("GC sees trigger " + effect + " on " + body.name)
body.queue_free()
func bulletDamage(target: Node2D, bullet: Node2D):
print("game controller sees hit")
target.queue_free()
bullet.visible = false