summaryrefslogtreecommitdiff
path: root/client/src/akkamon/scenes/BootScene.ts
blob: 98be8b6a1a517f0cf5d21f717c559fc80d5a12b3 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import Phaser from 'phaser';

import type {
    BasePhaserScene
} from '../PhaserTypes';

import { WorldScene } from './WorldScene';

function createBootScene<PhaserScene extends BasePhaserScene>(base: PhaserScene, sceneKey: string) {
    return class BootScene extends base {
        preload(): void {
            this.load.image("tiles", "assets/tilesets/akkamon-demo-extruded.png");
            // load from json!
            this.load.tilemapTiledJSON("map", "assets/tilemaps/akkamon-demo-tilemap.json");

            // An atlas is a way to pack multiple images together into one texture. I'm using it to load all
            // the player animations (walking left, walking right, etc.) in one image. For more info see:

            //  https://labs.phaser.io/view.html?src=src/animation/texture%20atlas%20animation.js
            // If you don't use an atlas, you can do the same thing with a spritesheet, see:
            //  https://labs.phaser.io/view.html?src=src/animation/single%20sprite%20sheet.js
            this.load.atlas("atlas",
                          "assets/atlas/atlas.png",
                              "assets/atlas/atlas.json");

            this.load.image("menu", "assets/images/pMenu.png");
            this.load.image("picker", "assets/images/menupicker.png");

            this.load.pack("pokemon-yellow-front", "assets/pokemon/main-sprites/yellow/pokemon-yellow-front.json")
            this.load.pack("pokemon-yellow-back", "assets/pokemon/main-sprites/yellow/pokemon-yellow-back.json")

            this.load.pack("general-interface", "assets/images/general-ui.json")
            this.load.pack("battle-interface", "assets/images/battle-ui.json")

            this.load.image("playerBack", "assets/pokemon/playerBack.png")
            this.load.image("opponentFront", "assets/pokemon/opponentFront.png")

        }

        create(): void {
            this.scene
            .launch('DemoScene')
            .remove()
        }
    }
}


let BootScene = createBootScene(Phaser.Scene, "BootScene");

export default BootScene;