@koreez/robotlegsjs-phaser3
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

RobotlegsJS Phaser3 Extension

Gitter chat npm version styled with prettier

Integrate RobotlegsJS framework with Phaser3.

Usage

import { Context, IContext, MVCSBundle } from "@robotlegsjs/core";
import { ContextSceneManager } from "../src";
import { PhaserBundle } from "../src/robotlegs/bender/bundles/phaser/PhaserBundle";
import "phaser";
import { Preload } from "./states/Preload";
import { SceneMediatorConfig } from "./config/SceneMediatorConfig";
import { Boot } from "./states/Boot";
import { SceneKey } from "./constants/StateKey";
import { GameConfig } from "./config/GameConfig";

export class Game extends Phaser.Game {
    private _context: IContext;

    constructor() {
        super({
            type: Phaser.CANVAS,
            width: 800,
            height: 600,
            backgroundColor: "#010101",
            parent: "phaser-example"
        });

        this._context = new Context();
        this._context
            .install(MVCSBundle, PhaserBundle)
            .configure(new ContextSceneManager((this as any).scene))
            .configure(SceneMediatorConfig)
            .configure(GameConfig)
            .initialize();
        this.scene.add(SceneKey.BOOT, new Boot(SceneKey.BOOT));
        this.scene.start(SceneKey.BOOT);
    }
}

See example

License

MIT

Package Sidebar

Install

npm i @koreez/robotlegsjs-phaser3

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

169 kB

Total Files

103

Last publish

Collaborators

  • arturvardanyan
  • gnun
  • saqsun
  • avagyanah