Connected the dialog box to the NPC
This commit is contained in:
@@ -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("")
|
||||
|
||||
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user