i tried to make a gameboyadvance dialoguebox for my game using the visible ratio property of ‘richtextlabel’. Even though the dialogue box works but it only works for the last dialogue and skips all the initial dialogues… please help me with this, here’s the script:
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
var base = $"."
text_box.visible = false
@onready var text_box = $TextBox
@onready var text_label = $TextBox/TextLabel
func PlayText(Text):
is_dialogue_running = true
text_box.visible = true
text_label.text = Text
var tween = create_tween().tween_property(text_label, "visible_ratio", 1, 3)
await tween.finished
wait(3)
text_label.visible_ratio = 0
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
var is_dialogue_running = false
func wait(durationX):
get_tree().create_timer(durationX).timeout
func StopDisplay():
text_box.visible = false
text_label.text = ""
func _on_timer_timeout():
PlayText("Hey there i am a Timmy and i lost my candy") #this line gets skipper
wait(10)
PlayText("Where can i buy more?") #this line plays
func _on_button_pressed():
text_box.visible = false
text_label.text = ""