Class: ArrayList

Phaser. ArrayList

Phaser.ArrayList

new ArrayList()

A set data structure. Allows items to add themselves to and remove themselves from the set. Items can only exist once in the set.

Source:

Members

first

Resets the cursor to the first item in the list and returns it.

Properties:
Name Type Description
first object

The first item in the list.

Source:

list

Properties:
Name Type Description
list array

The list.

Source:

next

Gets the next item in the list and returns it, advancing the cursor.

Properties:
Name Type Description
next object

Advanced the cursor and return.

Source:

position

Properties:
Name Type Description
position number

Current cursor position.

Default Value:
  • 0
Source:

total

Properties:
Name Type Description
total number

Number of objects in the list.

Default Value:
  • 0
Source:

Methods

add(child) → {object}

Adds a new element to this list. The item can only exist in the list once.

Parameters:
Name Type Description
child object

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

Source:
Returns:

The child that was added.

Type
object

callAll(callback, parameter)

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 Argument Description
callback function

The function to call.

parameter * <repeatable>

Additional parameters that will be passed to the callback.

Source:

exists(child) → {boolean}

Checks for the child within this list.

Parameters:
Name Type Description
child object

The element to get the list index for.

Source:
Returns:

True if the child is found in the list, otherwise false.

Type
boolean

getIndex(child) → {number}

Gets the index of the child in the list, or -1 if it isn't in the list.

Parameters:
Name Type Description
child object

The element to get the list index for.

Source:
Returns:

The index of the child or -1 if not found.

Type
number

remove(child) → {object}

Removes the given element from this list if it exists.

Parameters:
Name Type Description
child object

The child to be removed from the list.

Source:
Returns:

child - The child that was removed.

Type
object

reset()

Resets the list length and drops all items in the list.

Source:

setAll(key, value)

Sets the property key to the given value on all members of this list.

Parameters:
Name Type Description
key object

The object on the child to set.

value *

The value to set the property to.

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