extends Sprite2D signal di_continue # Called when the node enters the scene tree for the first time. func _ready(): #var canvas = get_parent().get_node("CanvasLayer") #await get_tree().create_timer(0.1).timeout #get_parent().remove_child(self) #canvas.add_child(self) pass var typing = false func dialogue(new_text,icon,dur): if typing == true: typing = false await di_continue typing = true var icons = $Icons.get_children() for i in icons: i.visible = false if i.name == icon: i.visible = true var leng = len(new_text) + 1 $RichTextLabel.visible_characters = 0 $RichTextLabel.text = new_text for i in leng: if typing == false: di_continue.emit() $AudioStreamPlayer.stop() return $RichTextLabel.visible_characters = i $AudioStreamPlayer.play() $Timer.start(dur/leng) await $Timer.timeout typing = false func _process(delta): pass