Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.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
Ecmascript 6 移相器CE开关状态_Ecmascript 6_Phaser Framework - Fatal编程技术网

Ecmascript 6 移相器CE开关状态

Ecmascript 6 移相器CE开关状态,ecmascript-6,phaser-framework,Ecmascript 6,Phaser Framework,我的phaser状态类如下所示: import {InitState} from './states/InitState'; import {SelectState} from './states/SelectState'; someFunction() { this._game = new Phaser.Game(800,400,Phaser.AUTO); this._game.state.add('INIT_STATE',InitState); this._game.state.add

我的phaser状态类如下所示:

import {InitState} from './states/InitState';
import {SelectState} from './states/SelectState';

someFunction()
{

this._game = new Phaser.Game(800,400,Phaser.AUTO);

this._game.state.add('INIT_STATE',InitState);
this._game.state.add('SELECT_STATE',SelectState);
this._game.state.start('INIT_STATE');
}
所以现在,当我开始我的第一个状态(“INIT_state”)时,一切正常,但当我尝试切换到另一个状态“SELECT_state”时,什么也没有发生

如果有人看到什么不对劲,请告诉我

当我调试的时候

第一个状态有参数:{game:p…r.game,键:“SELECT_state”}等等。 第二个状态没有任何参数:{game:null,key:,add:null,make:null,camera:null} 为什么会这样

我尝试使用es6 babel运行Phaser2.8.0


关于

SelectState对象中可能存在错误或打字错误,导致无法实例化?在INI_状态开始之前,JavaScript控制台中是否有其他错误消息?否,我使用static const,因此名称相同。前后无错误。只是移相器,不要切换状态。
export class InitState extends Phaser.State
{
    constructor()
    {
        super();
        console.log("[InitState] constructor");
    }
    preload()
    {
        console.log("[InitState] preload");
    }
    create()
    {
       console.log("[InitState] create");
      this.game.state.start('SELECT_STATE');
    }
}