Skip to content

Commit 0aa6650

Browse files
committed
Re-arranged methods and added parent.
1 parent 043efb7 commit 0aa6650

1 file changed

Lines changed: 21 additions & 22 deletions

File tree

src/gameobjects/components/Children.js

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
*
1010
* @class
1111
*/
12-
Phaser.Component.Children = function () {
12+
Phaser.Component.Children = function (parent) {
13+
14+
this.parent = parent;
1315

1416
// The objects that belong to this collection.
1517
// The equivalent of the old `Sprite.children` array.
@@ -193,8 +195,6 @@ Phaser.Component.Children.prototype = {
193195

194196
},
195197

196-
197-
198198
swap: function (child1, child2) {
199199

200200
if (child1 === child2)
@@ -215,7 +215,6 @@ Phaser.Component.Children.prototype = {
215215

216216
},
217217

218-
219218
// was setIndex
220219
moveTo: function (child, index) {
221220

@@ -295,6 +294,24 @@ Phaser.Component.Children.prototype = {
295294

296295
},
297296

297+
/**
298+
* Removes all the items.
299+
*
300+
* @method Phaser.ArraySet#removeAll
301+
*/
302+
removeAll: function () {
303+
304+
var i = this.list.length;
305+
306+
while (i--)
307+
{
308+
this.remove(this.list[i]);
309+
}
310+
311+
return this;
312+
313+
},
314+
298315
// Check to see if the given child is a child of this object, at any depth (recursively scans up the tree)
299316
contains: function (child) {
300317

@@ -499,24 +516,6 @@ Phaser.Component.Children.prototype = {
499516

500517
},
501518

502-
/**
503-
* Removes all the items.
504-
*
505-
* @method Phaser.ArraySet#reset
506-
*/
507-
reset: function () {
508-
509-
var i = this.list.length;
510-
511-
while (i--)
512-
{
513-
this.remove(this.list[i]);
514-
}
515-
516-
return this;
517-
518-
},
519-
520519
/**
521520
* Sets the property `key` to the given value on all members of this list.
522521
*

0 commit comments

Comments
 (0)