# Available only in the 2.2 legacy branch and posterior versions
func _ready():
# The old way:
print("HELLO") # Code before the yield
# Setting up the yield:
var t = Timer.new() # Create a new Timer node
t.set_wait_time(5.5) # Set the wait time
add_child(t) # Add it to the node tree as the direct child
t.start() # Start it
yield(t, "timeout") # Finally, make the script stop with the yield
print("WORLD") # Code that will be exectued after the yield
print("=====")
# The optional new way:
print("HELLO AGAIN!") # Code before the yield
# Setting up the yield with the new function 'create_timer()':
yield(get_tree().create_timer(5.5),"timeout")
print("WORLD") # Code that will be exectued after the yield