Have LineEdit influence animation in real time

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Erythrochroism

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
	if scene== 2:
		S2a = S2f% Stats.Name
	if scene== 3:

In my main scene node:

func _on_UI_Introduce():
	yield(get_tree().create_timer(2.0), "timeout")

func _on_UI_LineDone():
	yield(get_tree().create_timer(3.0), "timeout")
	print ("3")
	yield(get_tree().create_timer(2.0), "timeout")

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.

:bust_in_silhouette: Reply From: tuon

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.

That works much better, thank you.

Erythrochroism | 2020-08-10 23:51