mirror of
https://github.com/wassname/phaser.git
synced 2026-07-01 16:50:43 +08:00
Groups now update their children across preUpdate, update and postUpdate.
Sprite.exists = false removes Body from world.
This commit is contained in:
+52
-4
@@ -33,7 +33,7 @@ Phaser.Group = function (game, parent, name, addToStage) {
|
||||
|
||||
PIXI.DisplayObjectContainer.call(this);
|
||||
|
||||
if (typeof addToStage === 'undefined')
|
||||
if (typeof addToStage === 'undefined' || addToStage === false)
|
||||
{
|
||||
if (parent)
|
||||
{
|
||||
@@ -70,7 +70,6 @@ Phaser.Group = function (game, parent, name, addToStage) {
|
||||
/**
|
||||
* @property {Phaser.Group|Phaser.Sprite} parent - The parent of this Group.
|
||||
*/
|
||||
// this.group = null;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Point} scale - The scale of the Group container.
|
||||
@@ -125,8 +124,6 @@ Phaser.Group.SORT_ASCENDING = -1;
|
||||
*/
|
||||
Phaser.Group.SORT_DESCENDING = 1;
|
||||
|
||||
// PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
|
||||
|
||||
/**
|
||||
* Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object.
|
||||
* The child is automatically added to the top of the Group, so renders on-top of everything else within the Group. If you need to control
|
||||
@@ -704,6 +701,57 @@ Phaser.Group.prototype.callAll = function (method, context) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The core preUpdate - as called by World.
|
||||
* @method Phaser.Group#preUpdate
|
||||
* @protected
|
||||
*/
|
||||
Phaser.Group.prototype.preUpdate = function () {
|
||||
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
if (this.children[i]['preUpdate'])
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The core update - as called by World.
|
||||
* @method Phaser.Group#update
|
||||
* @protected
|
||||
*/
|
||||
Phaser.Group.prototype.update = function () {
|
||||
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
if (this.children[i]['update'])
|
||||
{
|
||||
this.children[i].update();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The core postUpdate - as called by World.
|
||||
* @method Phaser.Group#postUpdate
|
||||
* @protected
|
||||
*/
|
||||
Phaser.Group.prototype.postUpdate = function () {
|
||||
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
if (this.children[i]['postUpdate'])
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run.
|
||||
* After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child.
|
||||
|
||||
Reference in New Issue
Block a user