add(key, state, autoStart)
Adds a new State into the StateManager. You must give each State a unique key by which you'll identify it.
The State can be either a Phaser.State object (or an object that extends it), a plain JavaScript object or a function.
If a function is given a new state object will be created by calling it.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
key | string | A unique key you use to reference this state, i.e. "MainMenu", "Level1". | ||
state | Phaser.State | object | function | The state you want to switch to. | ||
autoStart | boolean | <optional> | false | If true the State will be started immediately after adding it. |
- Source code: core/StateManager.js (Line 183)
Please login to continue.