所以我试图提出" Hello World"格式化为离子https://gist.github.com/photonstorm/46cb8fb4b19fc7717dcad514cdcec064
的项目我已经生成了以下预加载,创建和更新功能:
function PHASER_preload() {
console.log("Preloading Assets");
this.load.setBaseURL('http://labs.phaser.io');
this.load.image('sky', 'assets/skies/space3.png');
this.load.image('logo', 'assets/sprites/phaser3-logo.png');
this.load.image('red', 'assets/particles/red.png');
}
function PHASER_create() {
console.log("Setting Up Phaser");
this.add.image(400, 300, 'sky');
var particles = this.add.particles('red');
var emitter = particles.createEmitter({
speed: 100,
scale: { start: 1, end: 0 },
blendMode: 'ADD'
});
var logo = this.physics.add.image(400, 100, 'logo');
logo.setVelocity(100, 200);
logo.setBounce(1, 1);
logo.setCollideWorldBounds(true);
emitter.startFollow(logo);
console.log("Setup Complete");
}
function PHASER_update() {
// Run's on update.
}
在离子,页面加载时,我们执行以下操作:
ionViewDidEnter() {
this.ConfigurePhaser();
}
ConfigurePhaser() {
console.log("Configuring Phaser")
var config = {
type: Phaser.AUTO,
width: window.innerWidth,
height: window.innerHeight,
physics: {
default: 'arcade',
arcade: {
gravity: { y: 200 }
}
},
scene: {
preload: PHASER_preload,
create: PHASER_create,
update: PHASER_update
}
};
this.game = new Phaser.Game(config);
}
所以基本上它是正常的Phaser设置,只是嵌入在离子中。
然而,当我运行时,游戏并没有显示出来。所有函数按预期执行(没有错误,我看到控制台输出),只是没有渲染。见附件。
思想?