extends TextureRect @onready var label: Label = $MarginContainer/Label var current_string : int = 0 var current_strings : Array[String] @onready var timer: Timer = $Timer signal dialog_page_finished @onready var enternote: Label = $ENTERNOTE func _ready() -> void: HudSignalBus.roll_dialog.connect(roll_dialog) func roll_dialog(strings: Array[String]): enternote.visible = false get_tree().create_tween().tween_property(self, "position:y", 395, 1) await get_tree().create_timer(1).timeout current_strings = strings current_string = 0 roll_page() func roll_page(): enternote.visible = false label.text = current_strings[current_string] label.visible_characters = 0 timer.start() current_string = current_string + 1 func _process(delta: float) -> void: if Input.is_action_just_pressed("advance_dialog") and current_strings.size() > 0 and timer.is_stopped(): if current_string < current_strings.size(): roll_page() else: current_strings = [] label.text = "" get_tree().create_tween().tween_property(self, "position:y", 648, 1) func _on_timer_timeout() -> void: if label.visible_characters < label.text.length(): label.visible_characters += 3 else: enternote.visible = true timer.stop() dialog_page_finished.emit()