godot-vn/game.gd

79 lines
1.5 KiB
GDScript3
Raw Normal View History

2018-09-21 02:43:57 +01:00
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")
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,
}
}
2018-09-21 02:48:13 +01:00
const Scenes = {
# MENUS
MAIN_MENU = "res://menus/main_menu.tscn",
# GAME
2018-09-21 03:11:14 +01:00
INTRO = "res://scenes/intro.tscn",
FIRST_SCENE = "res://scenes/first_scene.tscn"
2018-09-21 02:48:13 +01:00
}
2018-09-21 02:43:57 +01:00
func _register_functions():
2018-09-21 03:11:14 +01:00
current_registry["SWITCH_SCENE"] = funcref(self, "_switch_scene_fnc")
func _switch_scene_fnc(args):
if args.size() == 1:
var scene_name = args[0]
SceneSwitcher.goto_scene(Scenes[scene_name])
2018-09-21 02:43:57 +01:00
func _on_game_started_set(v):
if v and not game_started:
2018-09-21 03:11:14 +01:00
print("STARTO")
2018-09-21 02:43:57 +01:00
_on_game_start()
game_started = v
func _on_game_start():
# all game state here
current_registry = {}
2018-09-21 03:11:14 +01:00
print("YAH")
# register all de stuff
_register_functions()
2018-09-21 02:43:57 +01:00
func _ready():
pass