Skip to content

Commit 2a6a851

Browse files
authored
Merge pull request #68 from Crystalwarrior/fix-letter-tracking
Fixes the _char_position tracking in dialog_node.gd
2 parents de7618f + 08f8b69 commit 2a6a851

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

addons/textalog/nodes/dialogue_base_node/dialog_node/dialog_node.gd

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ func display_all_text() -> void:
4545
if text_node.visible_characters >= text_node.get_total_character_count():
4646
return
4747
text_node.visible_characters = text_node.get_total_character_count() -1
48-
_update_displayed_text()
48+
_char_position = text_node.visible_characters
49+
_update_displayed_text()
4950

5051

5152
## Starts displaying the text setted by [method set_text]
@@ -58,6 +59,7 @@ func display_text() -> void:
5859
func set_text(text:String) -> void:
5960
text_node.bbcode_text = text
6061
text_node.visible_characters = 0
62+
_char_position = 0
6163
rect_min_size = _original_size
6264
if text_fit_content_height:
6365
_enable_fit_content_height()
@@ -186,17 +188,18 @@ func _update_displayed_text() -> void:
186188
return
187189

188190
text_node.set_deferred("visible_characters", text_node.visible_characters+1)
189-
_text_timer.start(text_speed)
190191

191-
if text_node.visible_characters >= text_node.get_total_character_count():
192+
if text_node.visible_characters >= text_node.get_total_character_count()-1:
192193
_text_timer.stop()
193194
_blip_counter = 0
194-
_char_position = 0
195+
_char_position = text_node.get_total_character_count()
195196
_already_played = false
196197
emit_signal("text_displayed")
197198

198199
if text_show_scroll_at_end:
199200
_show_scroll()
201+
else:
202+
_text_timer.start(text_speed)
200203

201204

202205
func _update_original_size() -> void:

0 commit comments

Comments
 (0)