Fixed various issues in the TweenManager, added length property to Group and improved the build script.

This commit is contained in:
Richard Davey
2013-09-19 04:45:08 +01:00
parent cf26f68693
commit c5fc5e3394
8 changed files with 106 additions and 27 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* Phaser - http://www.phaser.io
*
* v1.0.1 - Built at: {buildDate}
* v{version} - Built at: {buildDate}
*
* @author Richard Davey http://www.photonstorm.com @photonstorm
*
+2
View File
@@ -139,6 +139,7 @@ Phaser.Animation.Parser = {
);
PIXI.TextureCache[uuid].realSize = frames[i].spriteSourceSize;
// PIXI.TextureCache[uuid].realSize = frames[i].sourceSize;
PIXI.TextureCache[uuid].trim.x = 0;
}
}
@@ -208,6 +209,7 @@ Phaser.Animation.Parser = {
);
PIXI.TextureCache[uuid].realSize = frames[key].spriteSourceSize;
// PIXI.TextureCache[uuid].realSize = frames[key].sourceSize;
PIXI.TextureCache[uuid].trim.x = 0;
}
+8
View File
@@ -832,6 +832,14 @@ Phaser.Group.prototype = {
};
Object.defineProperty(Phaser.Group.prototype, "length", {
get: function () {
return this._container.children.length;
}
});
Object.defineProperty(Phaser.Group.prototype, "x", {
get: function () {
+10 -3
View File
@@ -36,6 +36,8 @@ Phaser.Tween = function (object, game) {
this._pausedTime = 0;
this.pendingDelete = false;
// Set all starting values present on the target object
for ( var field in object ) {
this._valuesStart[ field ] = parseFloat(object[field], 10);
@@ -190,21 +192,21 @@ Phaser.Tween.prototype = {
},
onStart: function ( callback ) {
onStartCallback: function ( callback ) {
this._onStartCallback = callback;
return this;
},
onUpdate: function ( callback ) {
onUpdateCallback: function ( callback ) {
this._onUpdateCallback = callback;
return this;
},
onComplete: function ( callback ) {
onCompleteCallback: function ( callback ) {
this._onCompleteCallback = callback;
return this;
@@ -222,6 +224,11 @@ Phaser.Tween.prototype = {
update: function ( time ) {
if (this.pendingDelete)
{
return false;
}
if (this._paused || time < this._startTime) {
return true;
+13 -4
View File
@@ -13,6 +13,7 @@ Phaser.TweenManager = function (game) {
this.game = game;
this._tweens = [];
this._add = [];
this.game.onPause.add(this.pauseAll, this);
this.game.onResume.add(this.resumeAll, this);
@@ -50,7 +51,7 @@ Phaser.TweenManager.prototype = {
*/
add: function ( tween ) {
this._tweens.push( tween );
this._add.push( tween );
},
@@ -77,7 +78,7 @@ Phaser.TweenManager.prototype = {
if ( i !== -1 ) {
this._tweens.splice( i, 1 );
this._tweens[i].pendingDelete = true;
}
@@ -90,9 +91,10 @@ Phaser.TweenManager.prototype = {
*/
update: function () {
if ( this._tweens.length === 0 ) return false;
if ( this._tweens.length === 0 && this._add.length === 0 ) return false;
var i = 0, numTweens = this._tweens.length;
var i = 0;
var numTweens = this._tweens.length;
while ( i < numTweens ) {
@@ -110,6 +112,13 @@ Phaser.TweenManager.prototype = {
}
// If there are any new tweens to be added, do so now - otherwise they can be spliced out of the array before ever running
if (this._add.length > 0)
{
this._tweens = this._tweens.concat(this._add);
this._add.length = 0;
}
return true;
},