AnimationManager.play will now call Animation.stop on the current animation before switching to the new one (thanks @nihakue, #713)

This commit is contained in:
photonstorm 2014-04-14 23:29:09 +01:00
parent 5d0ea6453b
commit 25a93cf4af
2 changed files with 7 additions and 1 deletions

View file

@ -63,6 +63,7 @@ Version 2.0.4 - "Mos Shirare" - in development
* Timer has removed all use of local temporary vars in the core update loop.
* The Input.reset `hard` reset parameter is now passed down to the Keyboard and Key reset methods.
* AnimationManager.destroy now iterates through child animations calling destroy on all of them, avoiding a memory leak (thanks stauzs)
* AnimationManager.play will now call Animation.stop on the current animation before switching to the new one (thanks @nihakue, #713)
### New Features

View file

@ -195,7 +195,7 @@ Phaser.AnimationManager.prototype = {
if (this._anims[name])
{
if (this.currentAnim == this._anims[name])
if (this.currentAnim === this._anims[name])
{
if (this.currentAnim.isPlaying === false)
{
@ -205,6 +205,11 @@ Phaser.AnimationManager.prototype = {
}
else
{
if (this.currentAnim && this.currentAnim.isPlaying)
{
this.currentAnim.stop();
}
this.currentAnim = this._anims[name];
this.currentAnim.paused = false;
return this.currentAnim.play(frameRate, loop, killOnComplete);