@@ -138,11 +138,11 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
138138 this . cursor = null ;
139139
140140 /**
141- * A Group with `inputEnableChildren` set to `true` will automatically call `inputEnabled = true`
141+ * A Group with `inputEnableChildren` set to `true` will automatically call `inputEnabled = true`
142142 * on any children _added_ to, or _created by_, this Group.
143- *
143+ *
144144 * If there are children already in the Group at the time you set this property, they are not changed.
145- *
145+ *
146146 * @property {boolean } inputEnableChildren
147147 * @default
148148 */
@@ -152,10 +152,10 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
152152 * This Signal is dispatched whenever a child of this Group emits an onInputDown signal as a result
153153 * of having been interacted with by a Pointer. You can bind functions to this Signal instead of to
154154 * every child Sprite.
155- *
155+ *
156156 * This Signal is sent 2 arguments: A reference to the Sprite that triggered the signal, and
157157 * a reference to the Pointer that caused it.
158- *
158+ *
159159 * @property {Phaser.Signal } onChildInputDown
160160 */
161161 this . onChildInputDown = new Phaser . Signal ( ) ;
@@ -164,11 +164,11 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
164164 * This Signal is dispatched whenever a child of this Group emits an onInputUp signal as a result
165165 * of having been interacted with by a Pointer. You can bind functions to this Signal instead of to
166166 * every child Sprite.
167- *
168- * This Signal is sent 3 arguments: A reference to the Sprite that triggered the signal,
167+ *
168+ * This Signal is sent 3 arguments: A reference to the Sprite that triggered the signal,
169169 * a reference to the Pointer that caused it, and a boolean value `isOver` that tells you if the Pointer
170170 * is still over the Sprite or not.
171- *
171+ *
172172 * @property {Phaser.Signal } onChildInputUp
173173 */
174174 this . onChildInputUp = new Phaser . Signal ( ) ;
@@ -177,10 +177,10 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
177177 * This Signal is dispatched whenever a child of this Group emits an onInputOver signal as a result
178178 * of having been interacted with by a Pointer. You can bind functions to this Signal instead of to
179179 * every child Sprite.
180- *
180+ *
181181 * This Signal is sent 2 arguments: A reference to the Sprite that triggered the signal, and
182182 * a reference to the Pointer that caused it.
183- *
183+ *
184184 * @property {Phaser.Signal } onChildInputOver
185185 */
186186 this . onChildInputOver = new Phaser . Signal ( ) ;
@@ -189,10 +189,10 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
189189 * This Signal is dispatched whenever a child of this Group emits an onInputOut signal as a result
190190 * of having been interacted with by a Pointer. You can bind functions to this Signal instead of to
191191 * every child Sprite.
192- *
192+ *
193193 * This Signal is sent 2 arguments: A reference to the Sprite that triggered the signal, and
194194 * a reference to the Pointer that caused it.
195- *
195+ *
196196 * @property {Phaser.Signal } onChildInputOut
197197 */
198198 this . onChildInputOut = new Phaser . Signal ( ) ;
@@ -227,16 +227,16 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
227227 /**
228228 * If this Group contains Arcade Physics Sprites you can set a custom sort direction via this property.
229229 *
230- * It should be set to one of the Phaser.Physics.Arcade sort direction constants:
231- *
230+ * It should be set to one of the Phaser.Physics.Arcade sort direction constants:
231+ *
232232 * Phaser.Physics.Arcade.SORT_NONE
233233 * Phaser.Physics.Arcade.LEFT_RIGHT
234234 * Phaser.Physics.Arcade.RIGHT_LEFT
235235 * Phaser.Physics.Arcade.TOP_BOTTOM
236236 * Phaser.Physics.Arcade.BOTTOM_TOP
237237 *
238238 * If set to `null` the Group will use whatever Phaser.Physics.Arcade.sortDirection is set to. This is the default behavior.
239- *
239+ *
240240 * @property {integer } physicsSortDirection
241241 * @default
242242 */
@@ -256,10 +256,10 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
256256
257257 /**
258258 * A Group that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Group.cameraOffset.
259- *
259+ *
260260 * Note that the cameraOffset values are in addition to any parent in the display list.
261261 * So if this Group was in a Group that has x: 200, then this will be added to the cameraOffset.x
262- *
262+ *
263263 * @property {boolean } fixedToCamera
264264 */
265265 this . fixedToCamera = false ;
@@ -273,13 +273,13 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
273273
274274 /**
275275 * The hash array is an array belonging to this Group into which you can add any of its children via Group.addToHash and Group.removeFromHash.
276- *
276+ *
277277 * Only children of this Group can be added to and removed from the hash.
278- *
278+ *
279279 * This hash is used automatically by Phaser Arcade Physics in order to perform non z-index based destructive sorting.
280280 * However if you don't use Arcade Physics, or this isn't a physics enabled Group, then you can use the hash to perform your own
281281 * sorting and filtering of Group children without touching their z-index (and therefore display draw order)
282- *
282+ *
283283 * @property {array } hash
284284 */
285285 this . hash = [ ] ;
@@ -343,7 +343,7 @@ Phaser.Group.SORT_DESCENDING = 1;
343343*
344344* The child is automatically added to the top of the group, and is displayed above every previous child.
345345*
346- * Or if the _optional_ index is specified, the child is added at the location specified by the index value,
346+ * Or if the _optional_ index is specified, the child is added at the location specified by the index value,
347347* this allows you to control child ordering.
348348*
349349* If the child was already in this Group, it is simply returned, and nothing else happens to it.
@@ -419,7 +419,7 @@ Phaser.Group.prototype.add = function (child, silent, index) {
419419* Adds an existing object to this group.
420420*
421421* The child is added to the group at the location specified by the index value, this allows you to control child ordering.
422- *
422+ *
423423* If `Group.enableBody` is set, then a physics body will be created on the object, so long as one does not already exist.
424424*
425425* If `Group.inputEnableChildren` is set, then an Input Handler will be created on the object, so long as one does not already exist.
@@ -493,7 +493,7 @@ Phaser.Group.prototype.removeFromHash = function (child) {
493493*
494494* As well as an array you can also pass another Group as the first argument. In this case all of the children from that
495495* Group will be removed from it and added into this Group.
496- *
496+ *
497497* If `Group.enableBody` is set, then a physics body will be created on the objects, so long as one does not already exist.
498498*
499499* If `Group.inputEnableChildren` is set, then an Input Handler will be created on the objects, so long as one does not already exist.
@@ -545,12 +545,12 @@ Phaser.Group.prototype.getAt = function (index) {
545545* Creates a new Phaser.Sprite object and adds it to the top of this group.
546546*
547547* Use {@link #classType} to change the type of object created.
548- *
548+ *
549549* The child is automatically added to the top of the group, and is displayed above every previous child.
550550*
551- * Or if the _optional_ index is specified, the child is added at the location specified by the index value,
551+ * Or if the _optional_ index is specified, the child is added at the location specified by the index value,
552552* this allows you to control child ordering.
553- *
553+ *
554554* If `Group.enableBody` is set, then a physics body will be created on the object, so long as one does not already exist.
555555*
556556* If `Group.inputEnableChildren` is set, then an Input Handler will be created on the object, so long as one does not already exist.
@@ -580,16 +580,16 @@ Phaser.Group.prototype.create = function (x, y, key, frame, exists, index) {
580580
581581/**
582582* Creates multiple Phaser.Sprite objects and adds them to the top of this Group.
583- *
583+ *
584584* This method is useful if you need to quickly generate a pool of sprites, such as bullets.
585585*
586586* Use {@link #classType} to change the type of object created.
587587*
588588* You can provide an array as the `key` and / or `frame` arguments. When you do this
589589* it will create `quantity` Sprites for every key (and frame) in the arrays.
590- *
590+ *
591591* For example:
592- *
592+ *
593593* `createMultiple(25, ['ball', 'carrot'])`
594594*
595595* In the above code there are 2 keys (ball and carrot) which means that 50 sprites will be
@@ -611,9 +611,9 @@ Phaser.Group.prototype.create = function (x, y, key, frame, exists, index) {
611611* It will then create 20 'balls' of frame 0, 20 with frame 1 and 20 with frame 2.
612612* In total it will have created 120 sprites.
613613*
614- * By default the Sprites will have their `exists` property set to `false`, and they will be
614+ * By default the Sprites will have their `exists` property set to `false`, and they will be
615615* positioned at 0x0, relative to the `Group.x / y` values.
616- *
616+ *
617617* If `Group.enableBody` is set, then a physics body will be created on the objects, so long as one does not already exist.
618618*
619619* If `Group.inputEnableChildren` is set, then an Input Handler will be created on the objects, so long as one does not already exist.
@@ -694,7 +694,7 @@ Phaser.Group.prototype.updateZ = function () {
694694*
695695* This will align all of the children into a grid formation of 10x10, using 32 pixels per
696696* grid cell. If you want a wider grid, you could do:
697- *
697+ *
698698* `Group.align(25, 4, 32, 32)`
699699*
700700* This will align the children into a grid of 25x4, again using 32 pixels per grid cell.
@@ -705,19 +705,19 @@ Phaser.Group.prototype.updateZ = function () {
705705*
706706* `Group.align(-1, 8, 32, 32)`
707707*
708- * ... will align the children so that there are 8 children vertically (the second argument),
708+ * ... will align the children so that there are 8 children vertically (the second argument),
709709* and each row will contain 6 sprites, except the last one, which will contain 5 (totaling 48)
710710*
711711* You can also do:
712- *
712+ *
713713* `Group.align(10, -1, 32, 32)`
714714*
715715* In this case it will create a grid 10 wide, and as tall as it needs to be in order to fit
716716* all of the children in.
717717*
718718* The `position` property allows you to control where in each grid cell the child is positioned.
719- * This is a constant and can be one of `Phaser.TOP_LEFT` (default), `Phaser.TOP_CENTER`,
720- * `Phaser.TOP_RIGHT`, `Phaser.LEFT_CENTER`, `Phaser.CENTER`, `Phaser.RIGHT_CENTER`,
719+ * This is a constant and can be one of `Phaser.TOP_LEFT` (default), `Phaser.TOP_CENTER`,
720+ * `Phaser.TOP_RIGHT`, `Phaser.LEFT_CENTER`, `Phaser.CENTER`, `Phaser.RIGHT_CENTER`,
721721* `Phaser.BOTTOM_LEFT`, `Phaser.BOTTOM_CENTER` or `Phaser.BOTTOM_RIGHT`.
722722*
723723* The final argument; `offset` lets you start the alignment from a specific child index.
@@ -1726,10 +1726,10 @@ Phaser.Group.prototype.filter = function (predicate, checkExists) {
17261726* Note: This check will skip any children which are Groups themselves.
17271727*
17281728* @method Phaser.Group#forEach
1729- * @param {function } callback - The function that will be called for each applicable child. The child will be passed as the first argument.
1729+ * @param {function } callback - The function that will be called for each applicable child. The child will be passed as the first argument and the index of that child as the second argument .
17301730* @param {object } callbackContext - The context in which the function should be called (usually 'this').
17311731* @param {boolean } [checkExists=false] - If set only children matching for which `exists` is true will be passed to the callback, otherwise all children will be passed.
1732- * @param {...any } [args=(none)] - Additional arguments to pass to the callback function, after the child item .
1732+ * @param {...any } [args=(none)] - Additional arguments to pass to the callback function, after the other parameters .
17331733*/
17341734Phaser . Group . prototype . forEach = function ( callback , callbackContext , checkExists ) {
17351735
@@ -1741,7 +1741,7 @@ Phaser.Group.prototype.forEach = function (callback, callbackContext, checkExist
17411741 {
17421742 if ( ! checkExists || ( checkExists && this . children [ i ] . exists ) )
17431743 {
1744- callback . call ( callbackContext , this . children [ i ] ) ;
1744+ callback . call ( callbackContext , this . children [ i ] , i ) ;
17451745 }
17461746 }
17471747 }
@@ -1761,7 +1761,7 @@ Phaser.Group.prototype.forEach = function (callback, callbackContext, checkExist
17611761 if ( ! checkExists || ( checkExists && this . children [ i ] . exists ) )
17621762 {
17631763 args [ 0 ] = this . children [ i ] ;
1764- callback . apply ( callbackContext , args ) ;
1764+ callback . apply ( callbackContext , args . concat ( [ i ] ) ) ;
17651765 }
17661766 }
17671767 }
@@ -1856,7 +1856,7 @@ Phaser.Group.prototype.forEachDead = function (callback, callbackContext) {
18561856* Sort the children in the group according to a particular key and ordering.
18571857*
18581858* Call this function to sort the group according to a particular key value and order.
1859- *
1859+ *
18601860* For example to depth sort Sprites for Zelda-style game you might call `group.sort('y', Phaser.Group.SORT_ASCENDING)` at the bottom of your `State.update()`.
18611861*
18621862* Internally this uses a standard JavaScript Array sort, so everything that applies there also applies here, including
@@ -2070,7 +2070,7 @@ Phaser.Group.prototype.iterate = function (key, value, returnType, callback, cal
20702070
20712071/**
20722072* Get the first display object that exists, or doesn't exist.
2073- *
2073+ *
20742074* You can use the optional argument `createIfNull` to create a new Game Object if none matching your exists argument were found in this Group.
20752075*
20762076* It works by calling `Group.create` passing it the parameters given to this method, and returning the new child.
@@ -2244,7 +2244,7 @@ Phaser.Group.prototype.getBottom = function () {
22442244*
22452245* You can use the optional `callback` argument to apply your own filter to the distance checks.
22462246* If the child is closer then the previous child, it will be sent to `callback` as the first argument,
2247- * with the distance as the second. The callback should return `true` if it passes your
2247+ * with the distance as the second. The callback should return `true` if it passes your
22482248* filtering criteria, otherwise it should return `false`.
22492249*
22502250* @method Phaser.Group#getClosestTo
@@ -2288,7 +2288,7 @@ Phaser.Group.prototype.getClosestTo = function (object, callback, callbackContex
22882288*
22892289* You can use the optional `callback` argument to apply your own filter to the distance checks.
22902290* If the child is closer then the previous child, it will be sent to `callback` as the first argument,
2291- * with the distance as the second. The callback should return `true` if it passes your
2291+ * with the distance as the second. The callback should return `true` if it passes your
22922292* filtering criteria, otherwise it should return `false`.
22932293*
22942294* @method Phaser.Group#getFurthestFrom
@@ -2509,7 +2509,7 @@ Phaser.Group.prototype.moveAll = function (group, silent) {
25092509* Removes all children from this Group, but does not remove the group from its parent.
25102510*
25112511* The children can be optionally destroyed as they are removed.
2512- *
2512+ *
25132513* You can also optionally also destroy the BaseTexture the Child is using. Be careful if you've
25142514* more than one Game Object sharing the same BaseTexture.
25152515*
@@ -2666,7 +2666,7 @@ Object.defineProperty(Phaser.Group.prototype, "total", {
26662666* Total number of children in this group, regardless of exists/alive status.
26672667*
26682668* @name Phaser.Group#length
2669- * @property {integer } length
2669+ * @property {integer } length
26702670* @readonly
26712671*/
26722672Object . defineProperty ( Phaser . Group . prototype , "length" , {
@@ -2707,7 +2707,7 @@ Object.defineProperty(Phaser.Group.prototype, "angle", {
27072707*
27082708* It is derived by calling `getBounds`, calculating the Groups dimensions based on its
27092709* visible children.
2710- *
2710+ *
27112711* @name Phaser.Group#centerX
27122712* @property {number } centerX
27132713*/
@@ -2735,7 +2735,7 @@ Object.defineProperty(Phaser.Group.prototype, "centerX", {
27352735*
27362736* It is derived by calling `getBounds`, calculating the Groups dimensions based on its
27372737* visible children.
2738- *
2738+ *
27392739* @name Phaser.Group#centerY
27402740* @property {number } centerY
27412741*/
@@ -2763,7 +2763,7 @@ Object.defineProperty(Phaser.Group.prototype, "centerY", {
27632763*
27642764* It is derived by calling `getBounds`, calculating the Groups dimensions based on its
27652765* visible children.
2766- *
2766+ *
27672767* @name Phaser.Group#left
27682768* @property {number } left
27692769*/
@@ -2847,7 +2847,7 @@ Object.defineProperty(Phaser.Group.prototype, "top", {
28472847*
28482848* It is derived by calling `getBounds`, calculating the Groups dimensions based on its
28492849* visible children.
2850- *
2850+ *
28512851* @name Phaser.Group#bottom
28522852* @property {number } bottom
28532853*/
@@ -2875,17 +2875,17 @@ Object.defineProperty(Phaser.Group.prototype, "bottom", {
28752875* 'container', to one of 9 possible positions.
28762876*
28772877* The container must be a Game Object, or Phaser.Rectangle object. This can include properties
2878- * such as `World.bounds` or `Camera.view`, for aligning Groups within the world
2878+ * such as `World.bounds` or `Camera.view`, for aligning Groups within the world
28792879* and camera bounds. Or it can include other Sprites, Images, Text objects, BitmapText,
28802880* TileSprites or Buttons.
28812881*
28822882* Please note that aligning a Group to another Game Object does **not** make it a child of
28832883* the container. It simply modifies its position coordinates so it aligns with it.
2884- *
2884+ *
28852885* The position constants you can use are:
2886- *
2887- * `Phaser.TOP_LEFT`, `Phaser.TOP_CENTER`, `Phaser.TOP_RIGHT`, `Phaser.LEFT_CENTER`,
2888- * `Phaser.CENTER`, `Phaser.RIGHT_CENTER`, `Phaser.BOTTOM_LEFT`,
2886+ *
2887+ * `Phaser.TOP_LEFT`, `Phaser.TOP_CENTER`, `Phaser.TOP_RIGHT`, `Phaser.LEFT_CENTER`,
2888+ * `Phaser.CENTER`, `Phaser.RIGHT_CENTER`, `Phaser.BOTTOM_LEFT`,
28892889* `Phaser.BOTTOM_CENTER` and `Phaser.BOTTOM_RIGHT`.
28902890*
28912891* Groups are placed in such a way that their _bounds_ align with the
@@ -2917,18 +2917,18 @@ Object.defineProperty(Phaser.Group.prototype, "bottom", {
29172917* 'parent', in one of 11 possible positions.
29182918*
29192919* The parent must be a Game Object, or Phaser.Rectangle object. This can include properties
2920- * such as `World.bounds` or `Camera.view`, for aligning Groups within the world
2920+ * such as `World.bounds` or `Camera.view`, for aligning Groups within the world
29212921* and camera bounds. Or it can include other Sprites, Images, Text objects, BitmapText,
29222922* TileSprites or Buttons.
29232923*
29242924* Please note that aligning a Group to another Game Object does **not** make it a child of
29252925* the parent. It simply modifies its position coordinates so it aligns with it.
2926- *
2926+ *
29272927* The position constants you can use are:
2928- *
2929- * `Phaser.TOP_LEFT` (default), `Phaser.TOP_CENTER`, `Phaser.TOP_RIGHT`, `Phaser.LEFT_TOP`,
2930- * `Phaser.LEFT_CENTER`, `Phaser.LEFT_BOTTOM`, `Phaser.RIGHT_TOP`, `Phaser.RIGHT_CENTER`,
2931- * `Phaser.RIGHT_BOTTOM`, `Phaser.BOTTOM_LEFT`, `Phaser.BOTTOM_CENTER`
2928+ *
2929+ * `Phaser.TOP_LEFT` (default), `Phaser.TOP_CENTER`, `Phaser.TOP_RIGHT`, `Phaser.LEFT_TOP`,
2930+ * `Phaser.LEFT_CENTER`, `Phaser.LEFT_BOTTOM`, `Phaser.RIGHT_TOP`, `Phaser.RIGHT_CENTER`,
2931+ * `Phaser.RIGHT_BOTTOM`, `Phaser.BOTTOM_LEFT`, `Phaser.BOTTOM_CENTER`
29322932* and `Phaser.BOTTOM_RIGHT`.
29332933*
29342934* Groups are placed in such a way that their _bounds_ align with the
0 commit comments