Skip to content

Commit d83b142

Browse files
authored
Merge pull request phaserjs#5166 from samme/feature/group-setActive-setName
Add Group#setActive(), Group#setName()
2 parents 0ecaed4 + f1eb31c commit d83b142

1 file changed

Lines changed: 38 additions & 3 deletions

File tree

src/gameobjects/group/Group.js

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ var Group = new Class({
136136
this.name = GetFastValue(config, 'name', '');
137137

138138
/**
139-
* Whether this group runs its {@link Phaser.GameObjects.Group#preUpdate} method
140-
* (which may update any members).
139+
* Whether this group runs its {@link Phaser.GameObjects.Group#preUpdate} method (which may update any members).
141140
*
142141
* @name Phaser.GameObjects.Group#active
143142
* @type {boolean}
@@ -1108,6 +1107,42 @@ var Group = new Class({
11081107
return (capacity - used);
11091108
},
11101109

1110+
/**
1111+
* Sets the `active` property of this Group.
1112+
* When active, this Group runs its `preUpdate` method.
1113+
*
1114+
* @method Phaser.GameObjects.Group#setActive
1115+
* @since 3.24.0
1116+
*
1117+
* @param {boolean} value - True if this Group should be set as active, false if not.
1118+
*
1119+
* @return {this} This Group object.
1120+
*/
1121+
setActive: function (value)
1122+
{
1123+
this.active = value;
1124+
1125+
return this;
1126+
},
1127+
1128+
/**
1129+
* Sets the `name` property of this Group.
1130+
* The `name` property is not populated by Phaser and is presented for your own use.
1131+
*
1132+
* @method Phaser.GameObjects.Group#setName
1133+
* @since 3.24.0
1134+
*
1135+
* @param {string} value - The name to be given to this Group.
1136+
*
1137+
* @return {this} This Group object.
1138+
*/
1139+
setName: function (value)
1140+
{
1141+
this.name = value;
1142+
1143+
return this;
1144+
},
1145+
11111146
/**
11121147
* Sets the property as defined in `key` of each group member to the given value.
11131148
*
@@ -1265,7 +1300,7 @@ var Group = new Class({
12651300
/**
12661301
* Iterate through the group members changing the position of each element to be that of the element that came before
12671302
* it in the array (or after it if direction = 1)
1268-
*
1303+
*
12691304
* The first group member position is set to x/y.
12701305
*
12711306
* @method Phaser.GameObjects.Group#shiftPosition

0 commit comments

Comments
 (0)