0 votes

I have an animation sequence where I'd like to begin the animation, have the player asked for some input and then have that input be part of the animation. This is the code I have.

In my animation node:

  func dialogue(scene):
    if scene==1:
        S1a = S1f % Stats.Name
        $Label.text=(S1a)
    if scene== 2:
        S2a = S2f% Stats.Name
        $Label.text=(S2a)
    if scene== 3:
        $Label.text=(S3a)

In my main scene node:

func _on_UI_Introduce():
    $AnimationOg.play("intro")
    $AnimationOg/Label.show()
    $AnimationOg.dialogue(1)
    yield(get_tree().create_timer(2.0), "timeout")
    $AnimationOg.stop(false)
    $UI/LineEdit.show()

func _on_UI_LineDone():
    $AnimationOg.dialogue(1)
    $AnimationOg.play()
    yield(get_tree().create_timer(3.0), "timeout")
    print ("3")
    $AnimationOg.dialogue(2)
    yield(get_tree().create_timer(2.0), "timeout")
    $AnimationOg.dialogue(3)

The text input and everything all works fine, but the animation ends up really weird and glitchy, for example, it will play the last line multiple times, flickering and switching between colors and alignments.

My animation tracks

I apologize if I haven't formatted the right way, I'm quite new to this.

in Engine by (51 points)

1 Answer

+1 vote
Best answer

I suggest that instead of using timers, add "Call Method Track" tracks in your animation. This will be more flexible as you can then move the call to the method later. You can still call the stop function with a reset parameter value set to false and then play later to resume the animation.

by (208 points)
selected by

That works much better, thank you.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.