I’m making an RPG style game, it has a lot of text, I’m using “RichTextLabel” with BBCode to format the text. So far I’ve managed to get by, but I’m not able to place the “Typewriter” effect correctly on the text when I run the game.
Below is the script:
extends RichTextLabel
var fulltext = text
var currenttext = ''
var currentindex = 0
var typingspeed = 0.1
func _ready():
set_process(true)
get_tree().create_timer(typingspeed).timeout.connect(self._on_timeout)
func _process(_delta):
if currentindex < len(fulltext):
currenttext += fulltext[currentindex]
self.set_text(currenttext)
currentindex += 1
func _on_timeout():
_process(0)
For some reason, when I change the value of the typingspeed variable nothing happens. What I wanted was for the text to appear faster, or slower, as I changed this variable.
Can someone help me?!
Thank you very much in advance!