mirror of
https://github.com/photonstorm/phaser
synced 2024-12-01 00:49:41 +00:00
Added abillity to count children with matching properties
This commit is contained in:
parent
ca7acdc3bd
commit
e0adac3ced
1 changed files with 17 additions and 0 deletions
|
@ -223,6 +223,23 @@ var List = new Class({
|
|||
return output;
|
||||
},
|
||||
|
||||
count: function (property, value)
|
||||
{
|
||||
var total = 0;
|
||||
|
||||
for (var i = 0; i < this.list.length; i++)
|
||||
{
|
||||
var child = this.list[i];
|
||||
|
||||
if (child[property] === value)
|
||||
{
|
||||
total++;
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
},
|
||||
|
||||
swap: function (child1, child2)
|
||||
{
|
||||
if (child1 === child2)
|
||||
|
|
Loading…
Reference in a new issue