Flopsy/scenes/levels/01/interlude_01.gd

48 lines
1.6 KiB
GDScript3
Raw Permalink Normal View History

2022-07-17 17:08:39 +02:00
extends "res://scenes/levels/interlude.gd"
2022-07-17 14:24:15 +02:00
const text = [
["flake", "Hi there, who are you?", 0],
["flopsy", "Heya, I'm Flopsy.", 1],
["flake", "Hi Flopsy, I'm Flake. What are you doing here?", 1],
["flopsy", "I'm searching for my friends.", 1.5],
["flake", "Your friends? What happened to them?", 1],
["flopsy", "When I woke up this morning, all my friends were gone. I don't know, what happend.", 1.5],
["flake", "Maybe I can help you...", 2],
["flake", "When I was hunting a mouse this night, I saw some monsters...", 1],
["flake", "carrying gunnysacks to the old forest.", 1.5],
["flake", "I'm sure, I also heard barking from that direction.", 1.5],
["flopsy", "To the old forest? Oh no! I have to rescue them!", 1.5],
["flake", "Good luck!", 1.5],
["flopsy", "Thank you, goodbye!", 1]
]
func _ready():
_next_text()
func _next_text():
var current_text = text.pop_front()
if current_text != null:
yield(get_tree().create_timer(current_text[2]), "timeout")
if current_text[0] == "flake":
$CanvasLayer/speech_flopsy.fade_out()
yield(get_tree().create_timer(0.5), "timeout")
$CanvasLayer/speech_flake.say(current_text[1])
elif current_text[0] == "flopsy":
$CanvasLayer/speech_flake.fade_out()
yield(get_tree().create_timer(0.5), "timeout")
$CanvasLayer/speech_flopsy.say(current_text[1])
else:
$CanvasLayer/speech_flopsy.fade_out()
$CanvasLayer/speech_flake.fade_out()
yield(get_tree().create_timer(0.5), "timeout")
$CanvasLayer/Flopsy.set_animation("run")
$CanvasLayer/FlopsyMoveOut.play("move_out")
func _on_speech_flake_ready():
_next_text()
func _on_FlopsyMoveOut_finished(anim_name):
main.load_level(next_level, true)