Skip to content

Commit 8300787

Browse files
committed
updated: Group.filter documentation
1 parent 298622f commit 8300787

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/core/Group.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,15 +1203,14 @@ Phaser.Group.prototype.postUpdate = function () {
12031203
* Allows you to obtain a Phaser.ArrayList of children that return true for the given predicate
12041204
* For example:
12051205
* var healthyList = Group.filter(function(child, index, children) {
1206-
* if(child.exists && child.health > 10) {
1207-
* return true;
1208-
* }
1209-
* });
1206+
* return child.health > 10 ? true : false;
1207+
* }, true);
12101208
* healthyList.callAll('attack');
12111209
* Note: Currently this will skip any children which are Groups themselves.
12121210
* @method Phaser.Group#filter
12131211
* @param {function} predicate - 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
12141212
* @param {boolean} [checkExists=false] - If set only children with exists=true will be passed to the callback, otherwise all children will be passed.
1213+
* @return {Phaser.ArrayList} Returns an array list containing all the children that the predicate returned true for
12151214
*/
12161215
Phaser.Group.prototype.filter = function(predicate, checkExists) {
12171216
var index = -1,

0 commit comments

Comments
 (0)