mirror of
https://github.com/photonstorm/phaser
synced 2024-11-30 16:39:34 +00:00
Physics Groups will now call refresh automatically for you after a config creation
This commit is contained in:
parent
11d89cdb1f
commit
3aa609ddf6
2 changed files with 10 additions and 0 deletions
|
@ -28,6 +28,7 @@ var PhysicsGroup = new Class({
|
||||||
|
|
||||||
config.createCallback = this.createCallback;
|
config.createCallback = this.createCallback;
|
||||||
config.removeCallback = this.removeCallback;
|
config.removeCallback = this.removeCallback;
|
||||||
|
|
||||||
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
|
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
|
||||||
|
|
||||||
this.physicsType = CONST.DYNAMIC_BODY;
|
this.physicsType = CONST.DYNAMIC_BODY;
|
||||||
|
|
|
@ -27,6 +27,8 @@ var StaticPhysicsGroup = new Class({
|
||||||
|
|
||||||
config.createCallback = this.createCallback;
|
config.createCallback = this.createCallback;
|
||||||
config.removeCallback = this.removeCallback;
|
config.removeCallback = this.removeCallback;
|
||||||
|
config.createMultipleCallback = this.createMultipleCallback;
|
||||||
|
|
||||||
config.classType = ArcadeSprite;
|
config.classType = ArcadeSprite;
|
||||||
|
|
||||||
this.physicsType = CONST.STATIC_BODY;
|
this.physicsType = CONST.STATIC_BODY;
|
||||||
|
@ -50,6 +52,11 @@ var StaticPhysicsGroup = new Class({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createMultipleCallback: function (entries)
|
||||||
|
{
|
||||||
|
this.refresh();
|
||||||
|
},
|
||||||
|
|
||||||
refresh: function ()
|
refresh: function ()
|
||||||
{
|
{
|
||||||
var children = this.children.entries;
|
var children = this.children.entries;
|
||||||
|
@ -58,6 +65,8 @@ var StaticPhysicsGroup = new Class({
|
||||||
{
|
{
|
||||||
children[i].body.reset();
|
children[i].body.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue