2
我正在开发移动游戏,但我还是新手。我想在游戏的主屏幕中创建一个登录/注册/ fb表单。我在phaser的index.html中做了一个html表单,但是我有一些疑问。我怎样才能实现HTML和Phaser的场景之间的沟通?我创建了全局变量,但我认为这不是一个好的做法。移动登录/注册表
有没有任何选项可以使用像MyGame.MainPage.startGame()这样的html状态?
这是该指数的js脚本,功能相关的登录按钮:
function login(){
user = check_user_in_db();
if(user){ //If the login is correct
variable.startGame();
}
}
这是移相器的的MainPage一幕:
/*********************NAMESPACE********************/
var MyGame = MyGame || {};
/**************************************************/
/******************INIT APP SCENE******************/
MyGame.MainPage = function(game)
{
variable = this;
};
MyGame.MainPage.prototype =
{
init: function()
{
}, // init
preload: function()
{
//load Sprites
}, //preload
create: function()
{
//create Buttons
}, // create
shutdown: function()
{
}, // shutdown
startGame: function(){
this.state.start("Menu", true, false);
}
};
谢谢!!是的,最后我做到了 – kate23