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

Extends

Members


events :Phaser.Events.EventEmitter

The Scene's Event Emitter.

Type:
Since: 3.50.0
Source: src/gameobjects/DisplayList.js (Line 68)

scene :Phaser.Scene

The Scene that this Display List belongs to.

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

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

systems :Phaser.Scenes.Systems

The Scene's Systems.

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

Methods


depthSort()

Immediately sorts the display list if the flag is set.

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

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 204)
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 161)

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 188)
Returns:

The difference between the depths of each Game Object.

Type
number