@@ -213,7 +213,8 @@ Phaser.Sprite = function (game, x, y, key, frame) {
213213 calcWidth : - 1 , calcHeight : - 1 ,
214214
215215 // The current frame details
216- frameID : this . currentFrame . uuid , frameWidth : this . currentFrame . width , frameHeight : this . currentFrame . height ,
216+ // frameID: this.currentFrame.uuid, frameWidth: this.currentFrame.width, frameHeight: this.currentFrame.height,
217+ frameID : - 1 , frameWidth : this . currentFrame . width , frameHeight : this . currentFrame . height ,
217218
218219 boundsX : 0 , boundsY : 0 ,
219220
@@ -389,44 +390,6 @@ Phaser.Sprite.prototype.updateCache = function() {
389390 // |b d ty|
390391 // |0 0 1|
391392
392-
393- // this._cache.width = Math.floor(this.currentFrame.sourceSizeW);
394- // this._cache.height = Math.floor(this.currentFrame.sourceSizeH);
395- // this._cache.halfWidth = Math.floor(this._cache.width / 2);
396- // this._cache.halfHeight = Math.floor(this._cache.height / 2);
397-
398-
399- // this._cache.scaleX = this.scale.x;
400- // this._cache.scaleY = this.scale.y;
401-
402- /*
403- if (this.scale.x !== this._cache.realScaleX || this.scale.y !== this._cache.realScaleY)
404- {
405- console.log('rescale', this.name);
406- this._cache.width = this.width;
407- this._cache.height = this.height;
408- this._cache.halfWidth = Math.floor(this._cache.width / 2);
409- this._cache.halfHeight = Math.floor(this._cache.height / 2);
410- this._cache.realScaleX = this.scale.x;
411- this._cache.realScaleY = this.scale.y;
412- this.updateFrame = true;
413- this._cache.dirty = true;
414- }
415- */
416-
417- if ( this . _cache . calcWidth !== this . width || this . _cache . calcHeight !== this . height )
418- {
419- console . log ( 'calc' , this . name ) ;
420- this . _cache . width = Math . floor ( this . currentFrame . sourceSizeW ) ;
421- this . _cache . height = Math . floor ( this . currentFrame . sourceSizeH ) ;
422- this . _cache . halfWidth = Math . floor ( this . _cache . width / 2 ) ;
423- this . _cache . halfHeight = Math . floor ( this . _cache . height / 2 ) ;
424- this . _cache . frameWidth = this . texture . frame . width ;
425- this . _cache . frameHeight = this . texture . frame . height ;
426- this . _cache . frameID = this . currentFrame . uuid ;
427- this . _cache . dirty = true ;
428- }
429-
430393 if ( this . worldTransform [ 1 ] != this . _cache . i01 || this . worldTransform [ 3 ] != this . _cache . i10 )
431394 {
432395 this . _cache . a00 = this . worldTransform [ 0 ] ; // scaleX a
@@ -459,10 +422,10 @@ Phaser.Sprite.prototype.updateAnimation = function() {
459422
460423 if ( this . currentFrame && this . currentFrame . uuid != this . _cache . frameID )
461424 {
462- // console.log('ua frame 1 change', this.name);
463- // this._cache.frameWidth = this.texture.frame.width;
464- // this._cache.frameHeight = this.texture.frame.height;
465- // this._cache.frameID = this.currentFrame.uuid;
425+ console . log ( 'ua frame 1 change' , this . name ) ;
426+ this . _cache . frameWidth = this . texture . frame . width ;
427+ this . _cache . frameHeight = this . texture . frame . height ;
428+ this . _cache . frameID = this . currentFrame . uuid ;
466429 this . _cache . dirty = true ;
467430 }
468431
@@ -471,12 +434,12 @@ Phaser.Sprite.prototype.updateAnimation = function() {
471434 console . log ( 'ua frame 2 change' , this . name ) ;
472435 // this._cache.width = Math.floor(this.currentFrame.sourceSizeW * this._cache.scaleX);
473436 // this._cache.height = Math.floor(this.currentFrame.sourceSizeH * this._cache.scaleY);
474- // this._cache.width = this.currentFrame.width;
475- // // this._cache.height = this.currentFrame.height;
437+ this . _cache . width = this . currentFrame . width ;
438+ this . _cache . height = this . currentFrame . height ;
476439 // this._cache.width = Math.floor(this.currentFrame.sourceSizeW);
477440 // this._cache.height = Math.floor(this.currentFrame.sourceSizeH);
478- // this._cache.halfWidth = Math.floor(this._cache.width / 2);
479- // this._cache.halfHeight = Math.floor(this._cache.height / 2);
441+ this . _cache . halfWidth = Math . floor ( this . _cache . width / 2 ) ;
442+ this . _cache . halfHeight = Math . floor ( this . _cache . height / 2 ) ;
480443
481444 this . _cache . id = 1 / ( this . _cache . a00 * this . _cache . a11 + this . _cache . a01 * - this . _cache . a10 ) ;
482445 this . _cache . idi = 1 / ( this . _cache . a00 * this . _cache . a11 + this . _cache . i01 * - this . _cache . i10 ) ;
@@ -492,10 +455,16 @@ Phaser.Sprite.prototype.updateAnimation = function() {
492455Phaser . Sprite . prototype . updateBounds = function ( ) {
493456
494457 // Update the edge points
495- console . log ( 'updateBounds' , this . name ) ;
496458
497459 this . offset . setTo ( this . _cache . a02 - ( this . anchor . x * this . _cache . width ) , this . _cache . a12 - ( this . anchor . y * this . _cache . height ) ) ;
498460
461+ // this.offset.setTo(this._cache.a02 - (this.anchor.x * this.currentFrame.width), this._cache.a12 - (this.anchor.y * this.currentFrame.height));
462+ // this.offset.setTo(this._cache.a02 - (this.anchor.x * this.width), this._cache.a12 - (this.anchor.y * this.height));
463+
464+ // this.offset.setTo(this._cache.a02 - (this.anchor.x * this._cache.width), this._cache.a12 - (this.anchor.y * this._cache.height));
465+
466+ console . log ( 'updateBounds' , this . name , this . offset . x , this . offset . y ) ;
467+
499468 this . getLocalPosition ( this . center , this . offset . x + this . _cache . halfWidth , this . offset . y + this . _cache . halfHeight ) ;
500469 this . getLocalPosition ( this . topLeft , this . offset . x , this . offset . y ) ;
501470 this . getLocalPosition ( this . topRight , this . offset . x + this . _cache . width , this . offset . y ) ;
@@ -513,8 +482,8 @@ Phaser.Sprite.prototype.updateBounds = function() {
513482 this . _cache . boundsX = this . _cache . x ;
514483 this . _cache . boundsY = this . _cache . y ;
515484
516- this . _cache . calcWidth = this . width ;
517- this . _cache . calcHeight = this . height ;
485+ // this._cache.calcWidth = this.width;
486+ // this._cache.calcHeight = this.height;
518487
519488 this . updateFrame = true ;
520489
@@ -872,9 +841,10 @@ Phaser.Sprite.prototype.reset = function(x, y, health) {
872841*/
873842Phaser . Sprite . prototype . getLocalPosition = function ( p , x , y ) {
874843
875- // p.x = ((this._cache.a11 * this._cache.id * x + -this._cache.a01 * this._cache.id * y + (this._cache.a12 * this._cache.a01 - this._cache.a02 * this._cache.a11) * this._cache.id) * this.scale.x) + this._cache.a02;
876- // p.y = ((this._cache.a00 * this._cache.id * y + -this._cache.a10 * this._cache.id * x + (-this._cache.a12 * this._cache.a00 + this._cache.a02 * this._cache.a10) * this._cache.id) * this.scale.y) + this._cache.a12;
844+ p . x = ( ( this . _cache . a11 * this . _cache . id * x + - this . _cache . a01 * this . _cache . id * y + ( this . _cache . a12 * this . _cache . a01 - this . _cache . a02 * this . _cache . a11 ) * this . _cache . id ) * this . scale . x ) + this . _cache . a02 ;
845+ p . y = ( ( this . _cache . a00 * this . _cache . id * y + - this . _cache . a10 * this . _cache . id * x + ( - this . _cache . a12 * this . _cache . a00 + this . _cache . a02 * this . _cache . a10 ) * this . _cache . id ) * this . scale . y ) + this . _cache . a12 ;
877846
847+ /*
878848 if (this.worldTransform[0] == 1)
879849 {
880850 p.x = ((this._cache.a11 * this._cache.id * x + -this._cache.a01 * this._cache.id * y + (this._cache.a12 * this._cache.a01 - this._cache.a02 * this._cache.a11) * this._cache.id) * 1) + this._cache.a02;
@@ -892,6 +862,7 @@ Phaser.Sprite.prototype.getLocalPosition = function(p, x, y) {
892862 {
893863 p.y = ((this._cache.a00 * this._cache.id * y + -this._cache.a10 * this._cache.id * x + (-this._cache.a12 * this._cache.a00 + this._cache.a02 * this._cache.a10) * this._cache.id) * this.scale.y) + this._cache.a12;
894864 }
865+ */
895866
896867 return p ;
897868
0 commit comments