Class: Stage

Phaser. Stage

Phaser.Stage

new Stage(game, width, height)

The Stage controls the canvas on which everything is displayed. It handles display within the browser, focus handling, game resizing, scaling and the pause, boot and orientation screens.

Parameters:
Name Type Description
game Phaser.Game

Game reference to the currently running game.

width number

Width of the canvas element.

height number

Height of the canvas element.

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:

checkOffsetInterval

Properties:
Name Type Description
checkOffsetInterval number | false

The time (in ms) between which the stage should check to see if it has moved.

Default Value:
  • 2500
Source:

currentRenderOrderID

Properties:
Name Type Description
currentRenderOrderID number

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

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:

offset

Properties:
Name Type Description
offset Phaser.Point

Holds the offset coordinates of the Game.canvas from the top-left of the browser window (used by Input and other classes)

Source:

setBackgroundColor

Sets the background color for the stage.

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()

Parses a Game configuration object.

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 Apr 29 2014 14:51:35 GMT+0100 (BST) using the DocStrap template.