Class: DisplayList

Phaser.GameObjects. DisplayList

The Display List plugin.

Display Lists belong to a Scene and maintain the list of Game Objects to render every frame.

Some of these Game Objects may also be part of the Scene's Update List, for updating.


new DisplayList(scene)

Parameters:
Name Type Description
scene Phaser.Scene

The Scene that this Display List belongs to.

Since: 3.0.0
Source: src/gameobjects/DisplayList.js (Line 13)

Extends

Members


scene :Phaser.Scene

The Scene that this Display List belongs to.

Type:
Since: 3.0.0
Source: src/gameobjects/DisplayList.js (Line 49)

sortChildrenFlag :boolean

The flag the determines whether Game Objects should be sorted when depthSort() is called.

Type:
  • boolean
Since: 3.0.0
Default Value:
  • false
Source: src/gameobjects/DisplayList.js (Line 39)

systems :Phaser.Scenes.Systems

The Scene's Systems.

Type:
Since: 3.0.0
Source: src/gameobjects/DisplayList.js (Line 58)

Methods


depthSort()

Immediately sorts the display list if the flag is set.

Since: 3.0.0
Source: src/gameobjects/DisplayList.js (Line 109)

getChildren()

Returns an array which contains all objects currently on the Display List. This is a reference to the main list array, not a copy of it, so be careful not to modify it.

Since: 3.12.0
Source: src/gameobjects/DisplayList.js (Line 141)
Returns:

The group members.

Type
Array.<Phaser.GameObjects.GameObject>

queueDepthSort()

Force a sort of the display list on the next call to depthSort.

Since: 3.0.0
Source: src/gameobjects/DisplayList.js (Line 98)

sortByDepth(childA, childB)

Compare the depth of two Game Objects.

Parameters:
Name Type Description
childA Phaser.GameObjects.GameObject

The first Game Object.

childB Phaser.GameObjects.GameObject

The second Game Object.

Since: 3.0.0
Source: src/gameobjects/DisplayList.js (Line 125)
Returns:

The difference between the depths of each Game Object.

Type
integer