Let's take the official Hello World example and turn it into a desktop application powered by Electron. Follow these steps to do so:
- First, create the configuration file shown in the following code. It is almost the same one that we had earlier, but with an extra physics configuration section:
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#03187D',
physics: {
default: 'arcade',
arcade: {
gravity: { y: 200 }
}
},
scene: {
preload: preload,
create: create,
update: update
}
};
- Next, let's implement the preload function and load some image resources:
function preload() {
this.load.setBaseURL('http://labs.phaser.io');
this...