Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/435.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 相位器登录/注册表_Javascript_Facebook_Game Engine_Phaser Framework - Fatal编程技术网

Javascript 相位器登录/注册表

Javascript 相位器登录/注册表,javascript,facebook,game-engine,phaser-framework,Javascript,Facebook,Game Engine,Phaser Framework,我正在开发一款phaser游戏,但我还是新手。我想在游戏的主屏幕上创建一个登录/注册/fb表单。我在phaser的index.html中创建了一个html表单,但我有一些疑问。如何实现html和phaser场景之间的通信?我创建了全局变量,但我认为这不是一个好的实践 是否有任何选项可以使用MyGame.MainPage.StartName()之类的html状态 这是索引的js脚本,该函数与登录按钮关联: function login(){ user = check_user_in_db(

我正在开发一款phaser游戏,但我还是新手。我想在游戏的主屏幕上创建一个登录/注册/fb表单。我在phaser的index.html中创建了一个html表单,但我有一些疑问。如何实现html和phaser场景之间的通信?我创建了全局变量,但我认为这不是一个好的实践

是否有任何选项可以使用MyGame.MainPage.StartName()之类的html状态

这是索引的js脚本,该函数与登录按钮关联:

function login(){
    user = check_user_in_db();
    if(user){   //If the login is correct
        variable.startGame();
    }                  
}
这是Phaser的主页场景:

/*********************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);
    }
};

你可以试试这个Phaser插件

谢谢!!是的,最后我用它做了