separate data and logic setup

This commit is contained in:
Robin Hübner 2018-09-21 21:03:52 +02:00
parent 6d3ec7ef29
commit 237e3484cd
2 changed files with 55 additions and 42 deletions

43
data.gd Normal file
View File

@ -0,0 +1,43 @@
extends Node
# default game config
const DEFAULT_CHARS_PER_SECOND = 32
# voices for characters
const brain_voice = null
const arborator_voice = null
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",
OPTIONS_MENU = "res://menus/options_menu.tscn",
# GAME
INTRO = "res://scenes/intro.tscn",
FIRST_SCENE = "res://scenes/first_scene.tscn"
}
const Themes = {
}
const Images = {
INTRO_BG = "res://img/intro_bg.png"
}

54
game.gd
View File

@ -1,10 +1,16 @@
extends Node extends Node
# generic game globals const Data = preload("res://data.gd")
# pull them into Game too
const DEFAULT_CHARS_PER_SECOND = Data.DEFAULT_CHARS_PER_SECOND
const Characters = Data.Characters
const Images = Data.Images
const Scenes = Data.Scenes
const Themes = Data.Themes
# generic game config globals
var game_started = false setget _on_game_started_set var game_started = false setget _on_game_started_set
var current_registry
var reading_speed = 1.0 setget _on_set_reading_speed var reading_speed = 1.0 setget _on_set_reading_speed
var master_vol = 50 setget _on_set_master_vol var master_vol = 50 setget _on_set_master_vol
var music_vol = 50 setget _on_set_music_vol var music_vol = 50 setget _on_set_music_vol
@ -26,44 +32,8 @@ onready var sfx_player = get_node("sfx_player")
# transition node # transition node
onready var transition = get_node("trans_layer/transition") onready var transition = get_node("trans_layer/transition")
# voices for characters # actual game state here
const brain_voice = null var current_registry
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",
OPTIONS_MENU = "res://menus/options_menu.tscn",
# GAME
INTRO = "res://scenes/intro.tscn",
FIRST_SCENE = "res://scenes/first_scene.tscn"
}
const Themes = {}
const Images = {
INTRO_BG = "res://img/intro_bg.png"
}
func _ready(): func _ready():
pass pass