summaryrefslogtreecommitdiff
path: root/src/scenes.js
diff options
context:
space:
mode:
authorniliara-edu <nil.jimeno@estudiant.fjaverianas.com>2024-12-23 18:32:29 +0100
committerniliara-edu <nil.jimeno@estudiant.fjaverianas.com>2024-12-23 18:32:29 +0100
commita840990bdcabf45fb0d377478ba0ab27222434ae (patch)
tree030a6c3a6befce284733f5643d3972e3a1504bb2 /src/scenes.js
initial commit
Diffstat (limited to 'src/scenes.js')
-rw-r--r--src/scenes.js30
1 files changed, 30 insertions, 0 deletions
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
+ }
+}