From 25adfc618e77db9a5ee3b98ce0dab0be832efed0 Mon Sep 17 00:00:00 2001 From: niliara-edu Date: Tue, 24 Dec 2024 17:58:20 +0100 Subject: hello kitty base done --- src/scenes.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/scenes.js') 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) } -- cgit v1.2.3