Class: Stage

Phaser. Stage

Phaser.Stage

new Stage(game)

The Stage controls root level display objects upon which everything is displayed. It also handles browser visibility handling and the pausing due to loss of focus.

Parameters:
Name Type Description
game Phaser.Game

Game reference to the currently running game.

Source:

Extends

  • PIXI.Stage

Members

backgroundColor

Properties:
Name Type Description
backgroundColor number | string

Gets and sets the background color of the stage. The color can be given as a number: 0xff0000 or a hex string: '#ff0000'

Source:

currentRenderOrderID

Properties:
Name Type Description
currentRenderOrderID number

Reset each frame, keeps a count of the total number of objects updated.

Source:

destroy

Destroys the Stage and removes event listeners.

Source:

disableVisibilityChange

Properties:
Name Type Description
disableVisibilityChange boolean

By default if the browser tab loses focus the game will pause. You can stop that behaviour by setting this property to true.

Default Value:
  • false
Source:

exists

Properties:
Name Type Description
exists boolean

If exists is true the Stage and all children are updated, otherwise it is skipped.

Default Value:
  • true
Source:

game

Properties:
Name Type Description
game Phaser.Game

A reference to the currently running Game.

Source:

name

Properties:
Name Type Description
name string

The name of this object.

Default Value:
  • "_stage_root"
Source:

setBackgroundColor

Sets the background color for the Stage. The color can be given as a hex value (#RRGGBB) or a numeric value (0xRRGGBB)

Source:

smoothed

Enable or disable texture smoothing for all objects on this Stage. Only works for bitmap/image textures. Smoothing is enabled by default.

Properties:
Name Type Description
smoothed boolean

Set to true to smooth all sprites rendered on this Stage, or false to disable smoothing (great for pixel art)

Source:

Methods

checkVisibility()

Starts a page visibility event listener running, or window.blur/focus if not supported by the browser.

Source:

<protected> parseConfig(config)

Parses a Game configuration object.

Parameters:
Name Type Description
config object

The configuration object to parse.

Source:

postUpdate()

This is called automatically before the renderer runs and after the plugins have updated. In postUpdate this is where all the final physics calculatations and object positioning happens. The objects are processed in the order of the display list. The only exception to this is if the camera is following an object, in which case that is updated first.

Source:

preUpdate()

This is called automatically after the plugins preUpdate and before the State.update. Most objects have preUpdate methods and it's where initial movement and positioning is done.

Source:

update()

This is called automatically after the State.update, but before particles or plugins update.

Source:

visibilityChange(event)

This method is called when the document visibility is changed.

Parameters:
Name Type Description
event Event

Its type will be used to decide whether the game should be paused or not.

Source:
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Tue Sep 09 2014 15:29:40 GMT+0100 (BST) using the DocStrap template.