extends Node var voice_script = [ ["the_long", "book"], ["the_tall", "book"], ["the_door"], ["the_clock"], ["under_the_bed"], ["frog"], ["squirrel"], ["the_attic"], ["the_fridge"], ["the_tall", "book"], ["under_the_bed"], ["the_long", "book"], ["behind_the_bookshelf"], ] export var impatience: float = 10.0 func _ready(): yield(get_tree().create_timer(5.0), "timeout") script_loop() func read_line(line): $Sounds/show_me.play() yield($Sounds/show_me, "finished") for phrase in line: var sound = get_node("Sounds/" + phrase) sound.play() yield(sound, "finished") signal advance(did_time_out) func script_loop(): for line in voice_script: completed = false $ImpatienceTimer.stop() yield(read_line(line), "completed") $ImpatienceTimer.start(impatience) while not completed and yield(self, "advance"): yield(read_line(line), "completed") $ImpatienceTimer.start(impatience) var _err = get_tree().change_scene("res://screens/finished.tscn") var completed = false func advance(): completed = true emit_signal("advance", false) func _input(_event): if Input.is_action_just_pressed("cheat"): advance() func _on_ImpatienceTimer_timeout(): emit_signal("advance", true)