如何将 Phaser 网页游戏变成 Facebook 即时游戏?
How to turn a Phaser web game into Facebook instant game?
我使用 Phaser.io 制作了一个简单的网页游戏,现在我想把它变成一个 facebook 即时游戏。我试过关注一些文章,但没用。
关于从网络游戏制作 facebook 即时游戏的过程,您知道任何好的来源(文章、youtube 教程...)吗?
要将 Phaser 网页游戏托管到 Facebook Instant Games,请按照以下步骤操作:
首先,您需要创建一个new Facebook app。
您现在将登陆应用仪表板,现在您将select“设置”,然后“基本” .
现在在类别select“游戏”中,然后选择最适合您的游戏的类别。
回到控制面板,让我们select“小游戏”。
现在需要填写一些信息,确保“使用小游戏”设置为“是”.
现在您必须上传游戏的压缩文件。您可以在“虚拟主机”面板下,selecting “上传版本”进行此操作,
然后通过单击星形图标将其推送到生产环境。
之后,您必须在索引文件中包含 Facebook Instant Games API:
<script src="https://connect.facebook.net/en_US/fbinstant.6.0.js"></script>;
然后,在您的游戏文件中,当您通常在 window.onload
函数 上创建游戏本身时,您必须以这种方式创建它:
FBInstant.initializeAsync().then(function() {
FBInstant.setLoadingProgress(100);
FBInstant.startGameAsync().then(function() {
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
if(windowWidth > windowHeight){
windowWidth = windowHeight / 1.8;
}
var gameWidth = windowWidth * gameOptions.gameHeight / windowHeight;
game = new Phaser.Game(gameWidth, gameOptions.gameHeight, Phaser.CANVAS);
game.state.add("Boot", boot);
game.state.add("Preload", preload);
game.state.add("TitleScreen", titleScreen);
game.state.add("PlayGame", playGame);
game.state.start("Boot");
})
})
您可以查看 this tutorial 了解更多详细信息和视觉说明。
我使用 Phaser.io 制作了一个简单的网页游戏,现在我想把它变成一个 facebook 即时游戏。我试过关注一些文章,但没用。
关于从网络游戏制作 facebook 即时游戏的过程,您知道任何好的来源(文章、youtube 教程...)吗?
要将 Phaser 网页游戏托管到 Facebook Instant Games,请按照以下步骤操作:
首先,您需要创建一个new Facebook app。
您现在将登陆应用仪表板,现在您将select“设置”,然后“基本” .
现在在类别select“游戏”中,然后选择最适合您的游戏的类别。
回到控制面板,让我们select“小游戏”。
现在需要填写一些信息,确保“使用小游戏”设置为“是”.
现在您必须上传游戏的压缩文件。您可以在“虚拟主机”面板下,selecting “上传版本”进行此操作, 然后通过单击星形图标将其推送到生产环境。
之后,您必须在索引文件中包含 Facebook Instant Games API:
<script src="https://connect.facebook.net/en_US/fbinstant.6.0.js"></script>;
然后,在您的游戏文件中,当您通常在 window.onload
函数 上创建游戏本身时,您必须以这种方式创建它:
FBInstant.initializeAsync().then(function() {
FBInstant.setLoadingProgress(100);
FBInstant.startGameAsync().then(function() {
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
if(windowWidth > windowHeight){
windowWidth = windowHeight / 1.8;
}
var gameWidth = windowWidth * gameOptions.gameHeight / windowHeight;
game = new Phaser.Game(gameWidth, gameOptions.gameHeight, Phaser.CANVAS);
game.state.add("Boot", boot);
game.state.add("Preload", preload);
game.state.add("TitleScreen", titleScreen);
game.state.add("PlayGame", playGame);
game.state.start("Boot");
})
})
您可以查看 this tutorial 了解更多详细信息和视觉说明。