Skip to content

Commit 3aa609d

Browse files
committed
Physics Groups will now call refresh automatically for you after a config creation
1 parent 11d89cd commit 3aa609d

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

v3/src/physics/arcade/PhysicsGroup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var PhysicsGroup = new Class({
2828

2929
config.createCallback = this.createCallback;
3030
config.removeCallback = this.removeCallback;
31+
3132
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
3233

3334
this.physicsType = CONST.DYNAMIC_BODY;

v3/src/physics/arcade/StaticPhysicsGroup.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ var StaticPhysicsGroup = new Class({
2727

2828
config.createCallback = this.createCallback;
2929
config.removeCallback = this.removeCallback;
30+
config.createMultipleCallback = this.createMultipleCallback;
31+
3032
config.classType = ArcadeSprite;
3133

3234
this.physicsType = CONST.STATIC_BODY;
@@ -50,6 +52,11 @@ var StaticPhysicsGroup = new Class({
5052
}
5153
},
5254

55+
createMultipleCallback: function (entries)
56+
{
57+
this.refresh();
58+
},
59+
5360
refresh: function ()
5461
{
5562
var children = this.children.entries;
@@ -58,6 +65,8 @@ var StaticPhysicsGroup = new Class({
5865
{
5966
children[i].body.reset();
6067
}
68+
69+
return this;
6170
}
6271

6372
});

0 commit comments

Comments
 (0)