Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Phaser from "phaser";
- import PIX from "@/core";
- class DemoScene extends PIX.RPG.Scene.Raw {
- constructor (config) {
- super(config);
- }
- preload () {
- this.raw.load.image("logo", "/assets/logo.png");
- }
- init (params) {
- console.log("Scene transition delay", Date.now() - params.date);
- }
- create () {
- const image = this.raw.add.image(400, 150, "logo");
- }
- }
- class CustomOverworld extends PIX.RPG.Scene.Overworld {
- constructor (config) {
- super(config);
- }
- create () {
- super.create();
- this.player.setSkin(0);
- this.raw.time.addEvent({
- delay: 100,
- callback: this.changeScene,
- scope: this
- });
- }
- changeScene () {
- this.scene.change("demo", {
- date: Date.now()
- });
- }
- };
- const gameInstace = new PIX.RPG.Game({
- type: PIX.WEBGL,
- resolution: PIX.RESOLUTION.STANDART,
- parent: "container",
- scale: true,
- configFile: "/config/gameconfig.js"
- });
- gameInstace.scene.override(PIX.SCENE.OVERWORLD, CustomOverworld);
- gameInstace.scene.add("demo", DemoScene);
- gameInstace.start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement