const myCustomCanvas = document.createElement('canvas'); myCustomCanvas.id = 'myCustomCanvas'; myCustomCanvas.style = 'border: 8px solid red'; document.body.appendChild(myCustomCanvas); // var myCustomContext = myCustomCanvas.getContext('2d'); const config = { type: Phaser.CANVAS, parent: 'phaser-example', width: 800, height: 600, canvas: document.getElementById('myCustomCanvas'), scene: { preload: preload, create: create } }; const game = new Phaser.Game(config); function preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v355'); this.load.image('pic', 'assets/pics/baal-loader.png'); } function create () { this.add.image(400, 300, 'pic'); }
Scan to open on your mobile device
const myCustomCanvas = document.createElement('canvas'); myCustomCanvas.id = 'myCustomCanvas'; myCustomCanvas.style = 'border: 8px solid red'; document.body.appendChild(myCustomCanvas); // var myCustomContext = myCustomCanvas.getContext('2d'); const config = { type: Phaser.CANVAS, parent: 'phaser-example', width: 800, height: 600, canvas: document.getElementById('myCustomCanvas'), scene: { preload: preload, create: create } }; const game = new Phaser.Game(config); function preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v355'); this.load.image('pic', 'assets/pics/baal-loader.png'); } function create () { this.add.image(400, 300, 'pic'); }