diff options
Diffstat (limited to 'game_state.wren')
-rw-r--r-- | game_state.wren | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/game_state.wren b/game_state.wren index 9390261..42e1189 100644 --- a/game_state.wren +++ b/game_state.wren @@ -1,12 +1,27 @@ import "audio" for AudioEngine import "dome" for Window - +import "screens/menu_screen" for MenuScreen +import "screens/credit_screen" for CreditScreen +import "levels/level1" for Level1 +import "levels/level2" for Level2 class GameState { construct new() { AudioEngine.load("menu_music","assets/musics/04 All of Us - Menu.ogg") AudioEngine.load("level1_bg","assets/musics/01 A Night Of Dizzy Spells.ogg") AudioEngine.load("select","assets/sfx/select.wav") + AudioEngine.load("credit","assets/musics/Juhani Junkala [Retro Game Music Pack] Ending.wav") _fullScreen = false + + setupStates() + } + + setupStates() { + __gameStates = { + "menu": MenuScreen, + "credit": CreditScreen, + "level1": Level1, + "level2": Level2 + } } toggleFullscreen() { @@ -16,8 +31,8 @@ class GameState { switch(level) { AudioEngine.stopAllChannels() - _currentLevel = level.new(this) - System.print("Current Level : %(level.name)") + _currentLevel = __gameStates[level].new(this) + System.print("Current Level : %(__gameStates[level].name)") } update() { |