Merge pull request #2301 from samme/issue-2299

Stop only the named animation if `name` is passed
This commit is contained in:
Richard Davey 2016-02-01 18:12:45 +02:00
commit d6dcd0e5c6

View file

@ -308,20 +308,9 @@ Phaser.AnimationManager.prototype = {
if (resetFrame === undefined) { resetFrame = false; } if (resetFrame === undefined) { resetFrame = false; }
if (typeof name === 'string') if (this.currentAnim && (typeof name !== 'string' || name === this.currentAnim.name))
{ {
if (this._anims[name]) this.currentAnim.stop(resetFrame);
{
this.currentAnim = this._anims[name];
this.currentAnim.stop(resetFrame);
}
}
else
{
if (this.currentAnim)
{
this.currentAnim.stop(resetFrame);
}
} }
}, },