diff --git a/build/phaser.d.ts b/build/phaser.d.ts index e00778291d..477e3264ca 100644 --- a/build/phaser.d.ts +++ b/build/phaser.d.ts @@ -1126,6 +1126,7 @@ declare module Phaser { setFrame(frameId?: any, useLocalFrameIndex?: boolean): void; stop(resetFrame?: boolean, dispatchComplete?: boolean): void; update(): boolean; + updateFrameData(frameData: Phaser.FrameData): void; } diff --git a/src/gameobjects/Sprite.js b/src/gameobjects/Sprite.js index 64d776e3ee..f390452a23 100644 --- a/src/gameobjects/Sprite.js +++ b/src/gameobjects/Sprite.js @@ -361,9 +361,15 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame, stopAnimation) { frame = frame || 0; + if (stopAnimation || typeof stopAnimation === 'undefined') + { + this.animations.stop(); + } + this.key = key; var setFrame = true; + var smoothed = this.smoothed; if (key instanceof Phaser.RenderTexture) { @@ -395,10 +401,7 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame, stopAnimation) { { this.setTexture(new PIXI.Texture(PIXI.BaseTextureCache[key])); - if (this.animations) - { - setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key), frame); - } + setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key), frame); } } @@ -407,9 +410,9 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame, stopAnimation) { this._frame = Phaser.Rectangle.clone(this.texture.frame); } - if (stopAnimation || typeof stopAnimation === 'undefined') + if (!smoothed) { - this.animations.stop(); + this.smoothed = false; } };