var game = new Phaser.Game(375, 667, Phaser.AUTO);
var gameState = {
preload: function () {
game.stage.backgroundColor = `#a8d4bf`;
game.load.image('logo', './imgs/logo.png');
},
create: function() {
var text = game.add.text(game.world.centerX, 25, "first demo", {fill: '#0f0'});
text.anchor.set(0.5);
var img = game.add.image(game.world.centerX, game.world.centerY, 'logo');
img.anchor.set(0.5);
},
};
game.state.add('gameState', gameState);
game.state.start();
first demo
npm 安装就可以了