84 lines
1.6 KiB
GDScript
84 lines
1.6 KiB
GDScript
extends Node
|
|
|
|
# globals, for the game
|
|
var reading_speed = 1.0
|
|
|
|
var game_started = false setget _on_game_started_set
|
|
|
|
var current_registry
|
|
|
|
# music related
|
|
onready var music_player = get_node("music_player")
|
|
onready var sfx_player = get_node("sfx_player")
|
|
|
|
# transition node
|
|
onready var transition = get_node("trans_layer/transition")
|
|
|
|
signal on_music_volume_changed(new_value)
|
|
signal on_sfx_volume_changed(new_value)
|
|
signal on_reading_speed_changed(new_value)
|
|
|
|
signal on_settings_enter()
|
|
signal on_settings_exit()
|
|
|
|
const Themes = {}
|
|
|
|
# voices for characters
|
|
const brain_voice = null
|
|
const arborator_voice = null
|
|
|
|
const DEFAULT_CHARS_PER_SECOND = 32
|
|
|
|
const Characters = {
|
|
BRAIN = {
|
|
name = "~brain~",
|
|
name_colour = Color(1, 1, 1, 1),
|
|
voice = brain_voice,
|
|
talking_speed = 1.0,
|
|
},
|
|
ARBORATOR = {
|
|
name = "arborator",
|
|
name_colour = Color(1, 1, 1, 1),
|
|
voice = arborator_voice,
|
|
talking_speed = 1.0,
|
|
}
|
|
}
|
|
|
|
const Scenes = {
|
|
|
|
# MENUS
|
|
MAIN_MENU = "res://menus/main_menu.tscn",
|
|
|
|
# GAME
|
|
INTRO = "res://scenes/intro.tscn",
|
|
FIRST_SCENE = "res://scenes/first_scene.tscn"
|
|
|
|
}
|
|
|
|
func _register_functions():
|
|
current_registry["SWITCH_SCENE"] = funcref(self, "_switch_scene_fnc")
|
|
|
|
func _switch_scene_fnc(args):
|
|
if args.size() == 1:
|
|
var scene_name = args[0]
|
|
transition.start_transition()
|
|
yield(transition, "on_transition_completed")
|
|
SceneSwitcher.goto_scene(Scenes[scene_name])
|
|
|
|
func _on_game_started_set(v):
|
|
if v and not game_started:
|
|
print("STARTO")
|
|
_on_game_start()
|
|
game_started = v
|
|
|
|
func _on_game_start():
|
|
|
|
# all game state here
|
|
current_registry = {}
|
|
print("YAH")
|
|
# register all de stuff
|
|
_register_functions()
|
|
|
|
|
|
func _ready():
|
|
pass |