-
Notifications
You must be signed in to change notification settings - Fork 0
/
World.gd
63 lines (53 loc) · 1.81 KB
/
World.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
extends Control
var cutscene = preload("res://Overworld.tscn")
var Underworld = preload("res://Underworld.tscn")
var Title = preload("res://Title Screen.tscn")
enum Scene {
TITLE,
OVERWORLD,
UNDERWORLD
}
var curScene = Scene.TITLE
# Called when the node enters the scene tree for the first time.
func _ready():
toTitle()
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# print(str($Tree.z_index)+str($Player.z_index))
func toTitle():
if curScene == Scene.UNDERWORLD :
SceneFader.shader_fade_out($"Underworld")
$"Underworld".queue_free()
get_node("/root/World").remove_child($"Underworld")
curScene = Scene.TITLE
var title = Title.instance()
get_node("/root/World").add_child(title)
title.set_name("Title Screen")
Sound.startTitle()
$"Title Screen".connect("play", self, "toCutscene")
SceneFader.shader_fade_in($"Title Screen")
func toCutscene():
Sound.stopTitle()
SceneFader.shader_fade_out($"Title Screen")
var overworld = cutscene.instance()
$"Title Screen".queue_free()
get_node("/root/World").remove_child($"Title Screen")
get_node("/root/World").add_child(overworld)
overworld.set_name("Overworld")
$Overworld.connect("cutsceneEnd", self, "toUnderworld")
curScene = Scene.OVERWORLD
SceneFader.shader_fade_in($Overworld)
func toUnderworld():
$Textbox.queueText("Tom :\nHein ???")
SceneFader.shader_fade_out($Overworld)
$Textbox.queueText("Tom :\nC'est comme dans mon jeuuu !!!")
var underworld = Underworld.instance()
yield($Textbox, "noQueue")
get_node("/root/World").add_child(underworld)
underworld.set_name("Underworld")
$Underworld.connect("closeScene", self, "toTitle")
$Overworld.queue_free()
curScene = Scene.UNDERWORLD
get_node("/root/World").remove_child($Overworld)
SceneFader.shader_fade_in($Underworld)