Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | davidpgil | |
Old Version | Published before Godot 3 was released. |
My goal is to create a cutscene where the first scene is a page that has a traditional animation on it, and the following scene has “typwriter” text that executes via the following script:
extends RichTextLabel
var lapsed = 0
var charNum = 0
func _ready():
set_fixed_process(true)
func _fixed_process(delta):
lapsed = lapsed + delta
get_visible_characters()
charNum = set_visible_characters(lapsed / .03)
My problem is the “typewriter” text finishes typing while the first scene is animating. When I play the second scene by itself the “typewriter” text works.
I think I need a way to freeze the 2nd animation until the first animation is done. How would I go about doing this?
By the way, I started down t his path because I noticed using AnimationPlayer to animate text visibility in a RichTextLabel, just doesn’t work.
Thanks in advance for any help!
UPDATE 1:
I fixed my own issue by just initializing “lapsed” in _ready() to “0”. I now understand a bit more about how to use _ready().
extends RichTextLabel
var lapsed = 0
var charNum = 0
func _ready():
set_fixed_process(true)
lapsed = 0 # <<<< Added this
func _fixed_process(delta):
lapsed = lapsed + delta
get_visible_characters()
charNum = set_visible_characters(lapsed / .03)
davidpgil | 2017-10-24 04:14
UPDATE 2:
Ah, I just noticed that I did need to kick off _ready() with a signal. In my case I kicked off the _ready() of the node I wanted to work with using a signal. The following code snippet is what I did to make this work, combined with UPDATE 1:
trigger_node.connect("visibility_changed", observer_node, "_ready")
davidpgil | 2017-10-24 04:24
UPDATE 3:
I noticed there was a visible flicker when the typewriter text initially appeared so I tweaked the code to set_visible_characters() to 0 like so:
extends RichTextLabel
var lapsed = 0
var charNum = 0
func _ready():
set_fixed_process(true)
lapsed = 0
set_visible_characters(0) # <<<< Added this
func _fixed_process(delta):
lapsed = lapsed + delta
get_visible_characters()
charNum = set_visible_characters(lapsed / .03)
davidpgil | 2017-10-24 04:34
Thank you for creating this, it’s awesome!!
Echobear | 2018-12-23 08:17
Thank you for the appreciation!
davidpgil | 2018-12-23 15:30