I need to launch the phaser game with some input data such as: user, authorization token,score etc. How can I proceed. thx
I didn't figure out how to do it
this is my index.js
import Phaser
import BootScene from './scenes/boot'
import PreloadScene from './scenes/preload'
import GameScene from './scenes/game'
import GameScalePlugin from 'phaser-plugin-game-scale'
import {config} from './config'
let phaserConfig = config.phaser
phaserConfig.type = Phaser.AUTO
//phaserConfig.scene = [PreloadScene, GameScene]
phaserConfig.plugins = {
global: [{
key: 'GameScalePlugin',
plugin: GameScalePlugin,
mapping: 'gameScale',
data: {
debounce: false,
debounceDelay: 50, // Debounce interval, in ms
maxHeight: Infinity,
maxWidth: Infinity,
minHeight: config.size.minHeight,
minWidth: config.size.minWidth,
mode: 'fit',
resizeCameras: false, // Resize each scene camera when resizing the game
snap: null,
}
}]
}
phaserConfig.banner = { hidePhaser: true }
let game = new Phaser.Game(phaserConfig)
game.scene.add('BootScene', BootScene, true, {user:'test', auth:'test-auth'});
game.scene.add('PreloadScene', PreloadScene);
game.scene.add('GameScene', GameScene);
and this my boot.js
import { Scene } from 'phaser'
export default class BootScene extends Phaser.Scene {
constructor() { super({ key: 'Boot' }) }
preload() {
this.load.image('logo', './assets/logo.png')
}
init(...params){
console.info('INIT', params)
}
create(...params){
this.scene.start('Preload')
}
}
But in the boot it receives an empty object. is a problem within my config file?