Fixed bug where children of Groups wouldn't have their preUpdate methods called.

This commit is contained in:
Richard Davey
2013-08-09 20:03:36 +01:00
parent 0b1bcaf270
commit aff7d99a8a
6 changed files with 37 additions and 10 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<ProjectGuid>{BB30C59B-5B34-4F7C-B5CC-8D49EA280EDA}</ProjectGuid>
<ProjectGuid>{A90BE60F-CAEA-4747-904A-CDB097BA2459}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<OutputPath>bin</OutputPath>
+10 -1
View File
@@ -14,6 +14,7 @@ module Phaser {
this.game = game;
this.type = Phaser.Types.GROUP;
this.active = true;
this.exists = true;
this.visible = true;
@@ -114,6 +115,11 @@ module Phaser {
*/
public exists: boolean;
/**
* If this Group exists or not. Can be set to false to skip certain loop checks.
*/
public active: boolean;
/**
* Controls if this Group (and all of its contents) are rendered or skipped during the core game loop.
*/
@@ -184,7 +190,10 @@ module Phaser {
if (this._member != null && this._member.exists && this._member.active)
{
this._member.preUpdate();
if (this._member.type != Phaser.Types.GROUP)
{
this._member.preUpdate();
}
this._member.update();
}
}
+2
View File
@@ -550,6 +550,7 @@ module Phaser.Components {
* @param boundsSprite If you want to restrict the drag of this sprite to within the bounding box of another sprite, pass it here
*/
public enableDrag(lockCenter: boolean = false, bringToTop: boolean = false, pixelPerfect: boolean = false, alphaThreshold: number = 255, boundsRect: Rectangle = null, boundsSprite: Phaser.Sprite = null) {
this._dragPoint = new Point;
this.draggable = true;
@@ -569,6 +570,7 @@ module Phaser.Components {
{
this.boundsSprite = boundsSprite;
}
}
/**
+6
View File
@@ -217,6 +217,12 @@ module Phaser {
}
static renderSpriteWorldViewBounds(sprite: Phaser.Sprite, color: string = 'rgba(0,255,0,0.3)') {
Phaser.DebugUtils.renderRectangle(sprite.worldView, color);
}
/**
* Render debug infos. (including name, bounds info, position and some other properties)
* @param x {number} X position of the debug info to be rendered.
+9 -4
View File
@@ -15085,6 +15085,10 @@ var Phaser;
* Pre-update is called right before update() on each object in the game loop.
*/
Sprite.prototype.preUpdate = function () {
if (this.name == 'piece1') {
console.log('wv', this.worldView);
}
this.transform.update();
if (this.transform.scrollFactor.x != 1 && this.transform.scrollFactor.x != 0) {
@@ -18110,6 +18114,11 @@ var Phaser;
Phaser.DebugUtils.line('bottom: ' + sprite.worldView.bottom + ' right: ' + sprite.worldView.right.toFixed(1));
};
DebugUtils.renderSpriteWorldViewBounds = function (sprite, color) {
if (typeof color === "undefined") { color = 'rgba(0,255,0,0.3)'; }
Phaser.DebugUtils.renderRectangle(sprite.worldView, color);
};
DebugUtils.renderSpriteInfo = /**
* Render debug infos. (including name, bounds info, position and some other properties)
* @param x {number} X position of the debug info to be rendered.
@@ -19789,10 +19798,6 @@ var Phaser;
}
};
Game.prototype.emptyCallback = function () {
// Called by onUpdateCallback etc
};
/**
* Game loop method will be called when it's running.
*/
+9 -4
View File
@@ -15085,6 +15085,10 @@ var Phaser;
* Pre-update is called right before update() on each object in the game loop.
*/
Sprite.prototype.preUpdate = function () {
if (this.name == 'piece1') {
console.log('wv', this.worldView);
}
this.transform.update();
if (this.transform.scrollFactor.x != 1 && this.transform.scrollFactor.x != 0) {
@@ -18110,6 +18114,11 @@ var Phaser;
Phaser.DebugUtils.line('bottom: ' + sprite.worldView.bottom + ' right: ' + sprite.worldView.right.toFixed(1));
};
DebugUtils.renderSpriteWorldViewBounds = function (sprite, color) {
if (typeof color === "undefined") { color = 'rgba(0,255,0,0.3)'; }
Phaser.DebugUtils.renderRectangle(sprite.worldView, color);
};
DebugUtils.renderSpriteInfo = /**
* Render debug infos. (including name, bounds info, position and some other properties)
* @param x {number} X position of the debug info to be rendered.
@@ -19789,10 +19798,6 @@ var Phaser;
}
};
Game.prototype.emptyCallback = function () {
// Called by onUpdateCallback etc
};
/**
* Game loop method will be called when it's running.
*/