Navigation
These archived docs are for Phaser 2.6.1 Phaser 3 docs can be found on newdocs.phaser.io.
Phaser CE docs can be found on the Phaser CE Documentation site.

Constructor

Phaser. LinkedList

new LinkedList()

A basic Linked List data structure.

This implementation modifies the prev and next properties of each item added:

  • The prev and next properties must be writable and should not be used for any other purpose.
  • Items cannot be added to multiple LinkedLists at the same time.
  • Only objects can be added.
Source code: utils/LinkedList.js (Line 18)

Public Properties

first : Object

First element in the list.

Source code: utils/LinkedList.js (Line 39)

last : Object

Last element in the list.

Source code: utils/LinkedList.js (Line 46)

next : Object

Next element in the list.

Source code: utils/LinkedList.js (Line 25)

prev : Object

Previous element in the list.

Source code: utils/LinkedList.js (Line 32)

total : integer

Number of elements in the list.

Source code: utils/LinkedList.js (Line 53)

Public Methods

add(item) → {object}

Adds a new element to this linked list.

Parameters
Name Type Description
item object

The element to add to this list. Can be a Phaser.Sprite or any other object you need to quickly iterate through.

Returns
object -

The item that was added.

Source code: utils/LinkedList.js (Line 59)

callAll(callback)

Calls a function on all members of this list, using the member as the context for the callback. The function must exist on the member.

Parameters
Name Type Description
callback function

The function to call.

Source code: utils/LinkedList.js (Line 156)

remove(item)

Removes the given element from this linked list if it exists.

Parameters
Name Type Description
item object

The item to be removed from the list.

Source code: utils/LinkedList.js (Line 107)

reset()

Resets the first, last, next and previous node pointers in this list.

Source code: utils/LinkedList.js (Line 92)