Physics Groups will now call refresh automatically for you after a config creation

This commit is contained in:
Richard Davey 2017-12-02 04:03:57 +00:00
parent 11d89cdb1f
commit 3aa609ddf6
2 changed files with 10 additions and 0 deletions

View file

@ -28,6 +28,7 @@ var PhysicsGroup = new Class({
config.createCallback = this.createCallback;
config.removeCallback = this.removeCallback;
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
this.physicsType = CONST.DYNAMIC_BODY;

View file

@ -27,6 +27,8 @@ var StaticPhysicsGroup = new Class({
config.createCallback = this.createCallback;
config.removeCallback = this.removeCallback;
config.createMultipleCallback = this.createMultipleCallback;
config.classType = ArcadeSprite;
this.physicsType = CONST.STATIC_BODY;
@ -50,6 +52,11 @@ var StaticPhysicsGroup = new Class({
}
},
createMultipleCallback: function (entries)
{
this.refresh();
},
refresh: function ()
{
var children = this.children.entries;
@ -58,6 +65,8 @@ var StaticPhysicsGroup = new Class({
{
children[i].body.reset();
}
return this;
}
});