Phaser API Documentation

  Version: 
getAll([property], [value], [startIndex], [endIndex])

Description:

Returns all Game Objects in this Container.

You can optionally specify a matching criteria using the property and value arguments.

For example: getAll('body') would return only Game Objects that have a body property.

You can also specify a value to compare the property to:

getAll('visible', true) would return only Game Objects that have their visible property set to true.

Optionally you can specify a start and end index. For example if this Container had 100 Game Objects, and you set startIndex to 0 and endIndex to 50, it would return matches from only the first 50 Game Objects.

Parameters:

name type arguments Default description
property string <optional>

The property to test on each Game Object in the Container.

value any <optional>

If property is set then the property must strictly equal this value to be included in the results.

startIndex number <optional> 0

An optional start index to search from.

endIndex number <optional> Container.length

An optional end index to search up to (but not included)

Returns:
Description:

An array of matching Game Objects from this Container.

Since: 3.4.0