Skip to content

Commit f792f13

Browse files
committed
Added new quantity property to GroupCreateConfig
1 parent 422fbec commit f792f13

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/gameobjects/group/Group.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,15 @@ var Group = new Class({
349349
var randomKey = GetFastValue(options, 'randomKey', false);
350350
var randomFrame = GetFastValue(options, 'randomFrame', false);
351351
var yoyo = GetFastValue(options, 'yoyo', false);
352-
var quantity = GetFastValue(options, 'frameQuantity', 1);
352+
var quantity = GetFastValue(options, 'quantity', false);
353+
var frameQuantity = GetFastValue(options, 'frameQuantity', 1);
353354
var max = GetFastValue(options, 'max', 0);
354355

355-
// If a grid is set we use that to override the quantity?
356+
// If a quantity value is set we use that to override the frameQuantity
356357

357358
var range = Range(key, frame, {
358359
max: max,
359-
qty: quantity,
360+
qty: (quantity) ? quantity : frameQuantity,
360361
random: randomKey,
361362
randomB: randomFrame,
362363
repeat: repeat,

src/gameobjects/group/typedefs/GroupCreateConfig.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
* @property {?Function} [classType] - The class of each new Game Object.
1414
* @property {(string|string[])} [key] - The texture key of each new Game Object.
1515
* @property {?(string|string[]|integer|integer[])} [frame=null] - The texture frame of each new Game Object.
16+
* @property {?integer} [quantity=false] - The number of Game Objects to create. If set, this overrides the `frameQuantity` value. Use `frameQuantity` for more advanced control.
1617
* @property {?boolean} [visible=true] - The visible state of each new Game Object.
1718
* @property {?boolean} [active=true] - The active state of each new Game Object.
18-
* @property {?number} [repeat=0] - The number of times each `key` × `frame` combination will be *repeated* (after the first combination).
19+
* @property {?integer} [repeat=0] - The number of times each `key` × `frame` combination will be *repeated* (after the first combination).
1920
* @property {?boolean} [randomKey=false] - Select a `key` at random.
2021
* @property {?boolean} [randomFrame=false] - Select a `frame` at random.
2122
* @property {?boolean} [yoyo=false] - Select keys and frames by moving forward then backward through `key` and `frame`.
22-
* @property {?number} [frameQuantity=1] - The number of times each `frame` should be combined with one `key`.
23-
* @property {?number} [max=0] - The maximum number of new Game Objects to create. 0 is no maximum.
23+
* @property {?integer} [frameQuantity=1] - The number of times each `frame` should be combined with one `key`.
24+
* @property {?integer} [max=0] - The maximum number of new Game Objects to create. 0 is no maximum.
2425
* @property {?object} [setXY]
2526
* @property {?number} [setXY.x=0] - The horizontal position of each new Game Object.
2627
* @property {?number} [setXY.y=0] - The vertical position of each new Game Object.

0 commit comments

Comments
 (0)