summaryrefslogtreecommitdiff
path: root/src/scenes.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/scenes.js')
-rw-r--r--src/scenes.js22
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) }