Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Digno |
my actual code is
var textspd
func _on_Timer_timeout():
get_node(".").visible_characters += 1
func _ready():
$"Timer".start()
get_node(".").visible_characters = 0
textspd = 1
func _physics_process(_delta):
textspd = 1
get_node("Timer").wait_time = textspd * 0.1
print("visible characters = ", get_node(".").visible_characters)
how do i get to make textspd
increase if the last character is a .
or !
, ?
?
*get_node(“.”) is a label
Unrelated to your question, but you really don’t need any of those get_node(".")
calls. That just references the current node, which will happen by default… So, instead of this (for example):
get_node(".").visibile_characters = 0
you can simply do this:
visible_characters = 0
jgodfrey | 2022-11-30 19:49
i think i couldn’t do this in unity. i’m migrating to godot yk
Digno | 2022-11-30 21:11
Also, these references:
$"Timer".start()
and get_node("Timer").wait_time
can simply be:
$Timer.start()
and $Timer.wait_time
jgodfrey | 2022-11-30 21:27
For the actual question…
how do i get to make textspd increase if the last character is a . or !, ? ?
That’s a little ambiguous. Do you want to change the speed if the current character is one of those listed (so, at the time that char is about to be displayed), or do you want to change the speed for the entire string if the last character in the string is one of those listed?
jgodfrey | 2022-11-30 21:31
jgodfrey said:
That’s a little ambiguous. Do you want to change the speed if the
current character is one of those listed (so, at the time that char is
about to be displayed), or do you want to change the speed for the
entire string if the last character in the string is one of those
listed?
Yes, I was confused about that part as well .
Juxxec | 2022-12-01 08:10