From b908a2aeeed62d2d1e96e29e0b1c904e51097cd1 Mon Sep 17 00:00:00 2001 From: Julian Murgia Date: Thu, 11 Nov 2021 21:28:29 +0100 Subject: [PATCH] Fix: Make float dialog follow character (#430) --- addons/escoria-dialog-simple/types/floating.gd | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/addons/escoria-dialog-simple/types/floating.gd b/addons/escoria-dialog-simple/types/floating.gd index 69bc29e4..a802f7b4 100644 --- a/addons/escoria-dialog-simple/types/floating.gd +++ b/addons/escoria-dialog-simple/types/floating.gd @@ -45,6 +45,13 @@ func _ready(): $Tween.connect("tween_completed", self, "_on_dialog_line_typed") +func _process(delta): + # Position the RichTextLabel on the character's dialog position, if any. + rect_position = _current_character.get_node("dialog_position") \ + .get_global_transform_with_canvas().origin + rect_position.x -= rect_size.x / 2 + + # Make a character say something # # #### Parameters @@ -57,9 +64,11 @@ func say(character: String, line: String) : # Position the RichTextLabel on the character's dialog position, if any. _current_character = escoria.object_manager.get_object(character).node - rect_position = _current_character.get_node("dialog_position").get_global_transform_with_canvas().origin + rect_position = _current_character.get_node("dialog_position") \ + .get_global_transform_with_canvas().origin rect_position.x -= rect_size.x / 2 + # Start talking animation _current_character.start_talking() # Set text color to color set in the actor @@ -76,9 +85,10 @@ func say(character: String, line: String) : 0.0, 1.0, time_show_full_text, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT) tween.start() + set_process(true) -# Called by the dialog player when the +# Called by the dialog player when user wants to finish dialog fast. func speedup(): if not _is_speeding_up: _is_speeding_up = true