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:

Members

add

Properties:
Name Type Description
add Phaser.GameObjectFactory

Reference to the GameObjectFactory.

Source:

cache

Properties:
Name Type Description
cache Phaser.Cache

Reference to the assets cache.

Source:

camera

Properties:
Name Type Description
camera Phaser.Camera

A handy reference to world.camera.

Source:

game

Properties:
Name Type Description
game Phaser.Game

A reference to the currently running Game.

Source:

input

Properties:
Name Type Description
input Phaser.Input

Reference to the input manager

Source:

load

Properties:
Name Type Description
load Phaser.Loader

Reference to the assets loader.

Source:

make

Properties:
Name Type Description
make Phaser.GameObjectCreator

Reference to the GameObjectCreator.

Source:

math

Properties:
Name Type Description
math Phaser.Math

Reference to the math helper.

Source:

particles

Properties:
Name Type Description
particles Phaser.Particles

The Particle Manager for the game. It is called during the game update loop and in turn updates any Emitters attached to it.

Source:

physics

Properties:
Name Type Description
physics Phaser.Physics

Reference to the physics manager.

Source:

rnd

Properties:
Name Type Description
rnd Phaser.RandomDataGenerator

Reference to the random data generator.

Source:

scale

Properties:
Name Type Description
scale Phaser.ScaleManager

Reference to the game scale manager.

Source:

sound

Properties:
Name Type Description
sound Phaser.SoundManager

Reference to the sound manager.

Source:

stage

Properties:
Name Type Description
stage Phaser.Stage

Reference to the stage.

Source:

time

Properties:
Name Type Description
time Phaser.Time

Reference to the core game clock.

Source:

tweens

Properties:
Name Type Description
tweens Phaser.TweenManager

Reference to the tween manager.

Source:

world

Properties:
Name Type Description
world Phaser.World

Reference to the world.

Source:

Methods

create()

This method is called after the game engine successfully switches states. Feel free to add any setup code here (do not load anything here, override preload() instead).

Source:

loadRender()

Put render operations here.

Source:

loadUpdate()

Put update logic here.

Source:

paused()

This method will be called when game paused.

Source:

preload()

Override this method to add some load operations. If you need to use the loader, you may need to use them here.

Source:

render()

Put render operations here.

Source:

shutdown()

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

Source:

update()

Put update logic here.

Source: