Is There An Easier/Cleaner Way To Make Things Show Up One By One?

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

Here’s the code I have right now to have things show up one at a time:

func _on_Timer_timeout(): # First timer starts automatically
	$char1.show()
	$Timer2.start()

func _on_Timer2_timeout():
	$Name.show()
	$Timer3.start()

func _on_Timer3_timeout():
	$Club.show()
	$Timer4.start()

func _on_Timer4_timeout():
	$Genre.show()
	$Timer5.start()

func _on_Timer5_timeout():
	$Hobby.show()
	$Timer6.start()

func _on_Timer6_timeout():
	$Class.show()

All the timers are the same length. Could someone help me make this more convenient?

:bust_in_silhouette: Reply From: kidscancode

You could use an AnimationPlayer and set a keyframe for each node’s Visible property.

Video idea for you (if you haven’t already): Top 10 (or 100) Godot tips. (like this one).

duke_meister | 2018-07-10 06:02

:bust_in_silhouette: Reply From: eons

with timer in loop:

var timeout_count = 0
func _on_Timer_timeout():
  timeout_count += 1
  match timeout_count:
    1: do first thing
    2: do second thing
    _: $timer.stop() to finish the timer

But I agree with kidscancode, animation is better because you can make all the things visually and get the result you want easier.