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
+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;
},