From a840990bdcabf45fb0d377478ba0ab27222434ae Mon Sep 17 00:00:00 2001 From: niliara-edu Date: Mon, 23 Dec 2024 18:32:29 +0100 Subject: initial commit --- src/scenes.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/scenes.js (limited to 'src/scenes.js') diff --git a/src/scenes.js b/src/scenes.js new file mode 100644 index 0000000..09ea493 --- /dev/null +++ b/src/scenes.js @@ -0,0 +1,30 @@ +import * as PREQUEL from "./scenes/prequel.js" +import * as GAME from "./scenes/game.js" + +export const SCENES = { + PREQUEL: "prequel", + GAME: "game", +} + +export const SCENE = { + load: loadScene, + update: null, + draw: null, +} + +let currentScene + +function loadScene(scene) { + currentScene = scene + 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 + } +} -- cgit v1.2.3