Particles.Arcade.Emitter#filter()

filter(predicate, checkExists) → {Phaser.ArraySet}

Find children matching a certain predicate.

For example:

var healthyList = Group.filter(function(child, index, children) {
    return child.health > 10 ? true : false;
}, true);
healthyList.callAll('attack');

Note: Currently this will skip any children which are Groups themselves.

Parameters
Name Type Argument Default Description
predicate function

The function that each child will be evaluated against. Each child of the group will be passed to it as its first parameter, the index as the second, and the entire child array as the third

checkExists boolean <optional>
false

If true, only existing can be selected; otherwise all children can be selected and will be passed to the predicate.

Returns

Returns an array list containing all the children that the predicate returned true for

Inherited From
Source code: core/Group.js (Line 1677)
doc_phaser
2017-02-14 10:57:18
Comments
Leave a Comment

Please login to continue.