diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2021-07-28 16:52:08 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2021-07-28 16:52:08 +0200 |
| commit | 9e675c3652eb7a16ce5c2a865c030c76653c921e (patch) | |
| tree | 6ae24d621eb38b832ba6d6595d2ad87b6f1ec5aa /client/src/akkamon/scenes/BootScene.ts | |
| parent | 4d84c12df52c89abb7d3ba9f565753116b99dbf0 (diff) | |
feat(): refactor after playing with mixins
Diffstat (limited to 'client/src/akkamon/scenes/BootScene.ts')
| -rw-r--r-- | client/src/akkamon/scenes/BootScene.ts | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/client/src/akkamon/scenes/BootScene.ts b/client/src/akkamon/scenes/BootScene.ts index af70953..d3d8dba 100644 --- a/client/src/akkamon/scenes/BootScene.ts +++ b/client/src/akkamon/scenes/BootScene.ts @@ -1,44 +1,47 @@ import Phaser from 'phaser'; -import { AkkamonWorldScene } from './AkkamonWorldScene'; +import type { + BasePhaserScene +} from '../PhaserTypes'; -export class BootScene extends AkkamonWorldScene { - constructor() { - super('BootScene') - } - - init(): void { - } +import { WorldScene } from './WorldScene'; - 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"); +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: + // 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"); + // 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.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("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.pack("general-interface", "assets/images/general-ui.json") + this.load.pack("battle-interface", "assets/images/battle-ui.json") + } - create(): void { - this.scene + create(): void { + this.scene .launch('DemoScene') .remove() + } } } + +let BootScene = createBootScene(Phaser.Scene, "BootScene"); + +export default BootScene; |
