我是Javascript和Phaser的新手。我的游戏在我的虚拟主机中运行良好。我尝试添加 Instant Games SDK,但未加载资产。
我在Phaser 网站的 Phaser 3 教程中尝试过 Facebook Instant Games ,我尝试实现他们所说的,但没有任何效果;加载屏幕卡在 0%。
FBInstant.initializeAsync().then(function() {
let gameConfig = {
type: Phaser.AUTO,
backgroundColor:0x87ceeb,
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH,
parent: 'thegame',
width: window.innerWidth,
height: window.innerHeight
},
physics: {
default: 'arcade'
},
scene: [preloader,welcomeGame,
playGame,
resumeGame,
gameOver
]
}
game = new Phaser.Game(gameConfig);
});
class preloader extends Phaser.Scene{
constructor(){
super('Preloader');
}
preload() {
this.facebook.once('startgame', this.startGame, this);
this.facebook.showLoadProgress(this);
this.load.image('logoBanner', '/src/img/logoBanner.png');
//.
//.
//.
//.
this.load.audio("jump", ["/src/music/jump.ogg","/src/music/jump.mp3"]);
}
startGame ()
{
this.scene.start('WelcomeGame');
}