summaryrefslogtreecommitdiff
path: root/src/scenes.js
blob: 09ea49371ed6c30e43052d8f3e39d6d75cac7288 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
    }
}