diff options
author | niliara-edu <nil.jimeno@estudiant.fjaverianas.com> | 2024-12-24 17:58:20 +0100 |
---|---|---|
committer | niliara-edu <nil.jimeno@estudiant.fjaverianas.com> | 2024-12-24 17:58:20 +0100 |
commit | 25adfc618e77db9a5ee3b98ce0dab0be832efed0 (patch) | |
tree | 36ca56758ddd4674ab5a43df4b76bbfcc5a47af1 /src/scenes.js | |
parent | a840990bdcabf45fb0d377478ba0ab27222434ae (diff) |
hello kitty base done
Diffstat (limited to 'src/scenes.js')
-rw-r--r-- | src/scenes.js | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/scenes.js b/src/scenes.js index 09ea493..c6d175e 100644 --- a/src/scenes.js +++ b/src/scenes.js @@ -1,30 +1,38 @@ import * as PREQUEL from "./scenes/prequel.js" -import * as GAME from "./scenes/game.js" +import * as HELLO_KITTY from "./scenes/hello_kitty.js" +import { reload as reloadMain } from "./main.js" +import { Engine } from "./engine.js" export const SCENES = { PREQUEL: "prequel", - GAME: "game", + HELLO_KITTY: "hello kitty", } export const SCENE = { load: loadScene, update: null, draw: null, + restart: restartScene, } -let currentScene +export let currentScene function loadScene(scene) { + Engine.frame = 0 currentScene = scene + reloadMain() + if (currentScene == SCENES.PREQUEL) { PREQUEL.start() SCENE.update = PREQUEL.update SCENE.draw = PREQUEL.draw } - if (currentScene == SCENES.GAME) { - GAME.start() - SCENE.update = GAME.update - SCENE.draw = GAME.draw + if (currentScene == SCENES.HELLO_KITTY) { + HELLO_KITTY.start() + SCENE.update = HELLO_KITTY.update + SCENE.draw = HELLO_KITTY.draw } } + +function restartScene() { loadScene (currentScene) } |