Basic dialog system working
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
class_name ArrowGirl extends Area2D
|
||||
|
||||
@onready var _sprite = $AnimatedSprite2D
|
||||
var dialog_text = preload("res://DialogDebug_1.tres")
|
||||
var dialog_counter: int = 0
|
||||
var dialog_text: DialogText = preload("res://DialogDebug_1.tres")
|
||||
|
||||
#boilerplate
|
||||
func _ready():
|
||||
@@ -17,9 +16,4 @@ func _on_animation_finished() -> void:
|
||||
|
||||
func _on_body_entered(body) -> void:
|
||||
if body is BoxBoy:
|
||||
%DialogController.set_dialog(dialog_text.get_line_raw(dialog_counter), 0.2)
|
||||
dialog_counter += 1
|
||||
|
||||
func _on_body_exited(body) -> void:
|
||||
if body is BoxBoy:
|
||||
%DialogController.set_dialog("")
|
||||
%DialogController.set_dialog_text(dialog_text, 0.2)
|
||||
|
||||
@@ -38,7 +38,7 @@ animations = [{
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_53v1e"]
|
||||
size = Vector2(32, 32)
|
||||
size = Vector2(32, 96)
|
||||
|
||||
[node name="ArrowGirl" type="Area2D" unique_id=869288979]
|
||||
script = ExtResource("1_53v1e")
|
||||
@@ -49,10 +49,9 @@ animation = &"idle_glance"
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1190138841]
|
||||
visible = false
|
||||
position = Vector2(0, -32)
|
||||
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