Skip to content

Commit

Permalink
PhysicsGroup will now set the classType and null the config whe…
Browse files Browse the repository at this point in the history
…n an array of single configuration objects is given in the constructor. Fix #6519
  • Loading branch information
photonstorm committed Jul 21, 2023
1 parent 4fa348e commit 23cd25f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/physics/arcade/PhysicsGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,16 @@ var PhysicsGroup = new Class({
else if (Array.isArray(children) && IsPlainObject(children[0]))
{
// children is an array of plain objects (i.e., configs)
config = children[0];

var _this = this;

children.forEach(function (singleConfig)
{
singleConfig.internalCreateCallback = _this.createCallbackHandler;
singleConfig.internalRemoveCallback = _this.removeCallbackHandler;
singleConfig.classType = GetFastValue(singleConfig, 'classType', ArcadeSprite);
});

children = null;
config = null;
}
else
{
Expand Down Expand Up @@ -108,7 +107,10 @@ var PhysicsGroup = new Class({
* @since 3.0.0
* @see Phaser.Types.GameObjects.Group.GroupClassTypeConstructor
*/
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
if (config)
{
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
}

/**
* The physics type of the Group's members.
Expand Down

0 comments on commit 23cd25f

Please sign in to comment.