Parameters

Name

Type

Argument

Default

Description

width

number
|
string

<optional>

800

The width of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage width of the parent container, or the browser window if no parent is given.

height

number
|
string

<optional>

600

The height of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage height of the parent container, or the browser window if no parent is given.

renderer

number

<optional>

Phaser.AUTO

Which renderer to use: Phaser.AUTO will auto-detect, Phaser.WEBGL, Phaser.CANVAS or Phaser.HEADLESS (no rendering at all).

parent

string
|
HTMLElement

<optional>

''

The DOM element into which this games canvas will be injected. Either a DOM ID (string) or the element itself.

state

object

<optional>

null

The default state object. A object consisting of Phaser.State functions (preload, create, update, render) or null.

transparent

boolean

<optional>

false

Use a transparent canvas background or not.

antialias

boolean

<optional>

true

Draw all image textures anti-aliased or not. The default is for smooth textures, but disable if your game features pixel art.

physicsConfig

object

<optional>

null

A physics configuration object to pass to the Physics world on creation.

[readonly] isRunning : boolean

lockRender : boolean

If false Phaser will automatically render the display list every update. If true the render loop will be skipped.
You can toggle this value at run-time to gain exact control over when Phaser renders. This can be useful in certain types of game or application.
Please note that if you don't render the display list then none of the game object transforms will be updated, so use this value carefully.

parent : string | HTMLElement

Type

paused : boolean

The paused state of the Game. A paused game doesn't update any of its subsystems.
When a game is paused the onPause event is dispatched. When it is resumed the onResume event is dispatched. Gets and sets the paused state of the Game.

destroy()

disableStep()

enableStep()

Enable core game loop stepping. When enabled you must call game.step() directly (perhaps via a DOM button?)
Calling step will advance the game loop by one frame. This is extremely useful for hard to track down errors!

<internal> showDebugHeader()

step()

When stepping is enabled you must call this function directly (perhaps via a DOM button?) to advance the game loop by one frame.
This is extremely useful to hard to track down errors! Use the internal stepCount property to monitor progress.

<internal> updateRender(elapsedTime)

Runs the Render cycle.
It starts by calling State.preRender. In here you can do any last minute adjustments of display objects as required.
It then calls the renderer, which renders the entire display list, starting from the Stage object and working down.
It then calls plugin.render on any loaded plugins, in the order in which they were enabled.
After this State.render is called. Any rendering that happens here will take place on-top of the display list.
Finally plugin.postRender is called on any loaded plugins, in the order in which they were enabled.
This method is called automatically by Game.update, you don't need to call it directly.
Should you wish to have fine-grained control over when Phaser renders then use the Game.lockRender boolean.
Phaser will only render when this boolean is false.

Parameters

Name

Type

Description

elapsedTime

number

The time elapsed since the last update.

Internal:

This member is internal (protected) and may be modified or removed in the future.