Connected the dialog box to the NPC

This commit is contained in:
2026-03-11 16:54:12 +11:00
parent 21141376d2
commit 94b810e4f1
3 changed files with 16 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
class_name ArrowGirl extends Area2D
@onready var _dialogController = $/root/Scene/DialogController
@onready var _sprite = $AnimatedSprite2D
#boilerplate
@@ -12,3 +13,11 @@ func _on_animation_finished() -> void:
_sprite.play("idle_glance", 2)
else:
_sprite.play("idle", 2)
func _on_body_entered(body) -> void:
if body is BoxBoy:
_dialogController.set_dialog("Hello.", 0.2)
func _on_body_exited(body) -> void:
if body is BoxBoy:
_dialogController.set_dialog("")

View File

@@ -52,4 +52,6 @@ metadata/_edit_lock_ = true
shape = SubResource("RectangleShape2D_53v1e")
metadata/_edit_lock_ = true
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"]