# Class: State

## Phaser. State

Phaser.State

#### new State()

  This is a base State class which can be extended if you are creating your own game. It provides quick access to common functions such as the camera, cache, input, match, sound and more.

  Source:
    - core/State.js, line 15

### Members

#### add

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `add` | Phaser.GameObjectFactory | A reference to the GameObjectFactory which can be used to add new objects to the World.

  Source:
    - core/State.js, line 25

#### cache

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `cache` | Phaser.Cache | A reference to the game cache which contains any loaded or generated assets, such as images, sound and more.

  Source:
    - core/State.js, line 40

#### camera

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `camera` | Phaser.Camera | A handy reference to World.camera.

  Source:
    - core/State.js, line 35

#### game

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `game` | Phaser.Game | This is a reference to the currently running Game.

  Source:
    - core/State.js, line 20

#### input

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `input` | Phaser.Input | A reference to the Input Manager.

  Source:
    - core/State.js, line 45

#### load

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `load` | Phaser.Loader | A reference to the Loader, which you mostly use in the preload method of your state to load external assets.

  Source:
    - core/State.js, line 50

#### make

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `make` | Phaser.GameObjectCreator | A reference to the GameObjectCreator which can be used to make new objects.

  Source:
    - core/State.js, line 30

#### math

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `math` | Phaser.Math | A reference to Math class with lots of helpful functions.

  Source:
    - core/State.js, line 55

#### particles

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `particles` | Phaser.Particles | The Particle Manager. It is called during the core gameloop and updates any Particle Emitters it has created.

  Source:
    - core/State.js, line 90

#### physics

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `physics` | Phaser.Physics | A reference to the physics manager which looks after the different physics systems available within Phaser.

  Source:
    - core/State.js, line 95

#### rnd

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `rnd` | Phaser.RandomDataGenerator | A reference to the seeded and repeatable random data generator.

  Source:
    - core/State.js, line 100

#### scale

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `scale` | Phaser.ScaleManager | A reference to the Scale Manager which controls the way the game scales on different displays.

  Source:
    - core/State.js, line 65

#### sound

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `sound` | Phaser.SoundManager | A reference to the Sound Manager which can create, play and stop sounds, as well as adjust global volume.

  Source:
    - core/State.js, line 60

#### stage

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `stage` | Phaser.Stage | A reference to the Stage.

  Source:
    - core/State.js, line 70

#### time

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `time` | Phaser.Time | A reference to the game clock and timed events system.

  Source:
    - core/State.js, line 75

#### tweens

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `tweens` | Phaser.TweenManager | A reference to the tween manager.

  Source:
    - core/State.js, line 80

#### world

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `world` | Phaser.World | A reference to the game world. All objects live in the Game World and its size is not bound by the display resolution.

  Source:
    - core/State.js, line 85

### Methods

#### create()

  create is called once preload has completed, this includes the loading of any assets from the Loader. If you don't have a preload method then create is the first method called in your State.

  Source:
    - core/State.js, line 133

#### loadRender()

  loadRender is called during the Loader process. This only happens if you've set one or more assets to load in the preload method. The difference between loadRender and render is that any objects you render in this method you must be sure their assets exist.

  Source:
    - core/State.js, line 124

#### loadUpdate()

  loadUpdate is called during the Loader process. This only happens if you've set one or more assets to load in the preload method.

  Source:
    - core/State.js, line 116

#### paused()

  This method will be called if the core game loop is paused.

  Source:
    - core/State.js, line 162

#### pauseUpdate()

  pauseUpdate is called while the game is paused instead of preUpdate, update and postUpdate.

  Source:
    - core/State.js, line 170

#### preload()

  preload is called first. Normally you'd use this to load your game assets (or those needed for the current State) You shouldn't create any objects in this method that require assets that you're also loading in this method, as they won't yet be available.

  Source:
    - core/State.js, line 106

#### render()

  Nearly all display objects in Phaser render automatically, you don't need to tell them to render. However the render method is called AFTER the game renderer and plugins have rendered, so you're able to do any final post-processing style effects here. Note that this happens before plugins postRender takes place.

  Source:
    - core/State.js, line 152

#### shutdown()

  This method will be called when the State is shutdown (i.e. you switch to another state from this one).

  Source:
    - core/State.js, line 178

#### update()

  The update method is left empty for your own use. It is called during the core game loop AFTER debug, physics, plugins and the Stage have had their preUpdate methods called. If is called BEFORE Stage, Tweens, Sounds, Input, Physics, Particles and Plugins have had their postUpdate methods called.

  Source:
    - core/State.js, line 142