Skip to content

Commit 2443723

Browse files
committed
When an Animation completes playback and isn't set to loop it would change the currentFrame property to be the first frame in the set after the onComplete callback had fired. This meant if you set a Sprite to a new frame within an Animation onComplete callback then your change would have been overwritten by the animation itself. This is now no longer the case.
1 parent dc82fe6 commit 2443723

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ We've rolled our own fixes into our version of Pixi, ensuring we keep it as bug-
195195
* The Physics Manager now has a new `reset` method which will reset the active physics systems. This is called automatically on a State swap (thanks @englercj #1691)
196196
* When a State is started and linked to Phaser it has a new property created on it: `key`, which is the string identifier used by the State.
197197
* When the Game first boots it will now call `window.focus()`. This allows keyboard events to work properly in IE when the game is running inside an iframe. You can stop this from happening by setting `window.PhaserGlobal.stopFocus = true` (thanks @webholics #1681)
198+
* When an Animation completes playback and isn't set to loop it would change the `currentFrame` property to be the first frame in the set after the `onComplete` callback had fired. This meant if you set a Sprite to a new frame within an Animation onComplete callback then your change would have been overwritten by the animation itself. This is now no longer the case.
198199

199200
### Bug Fixes
200201

src/animation/Animation.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,18 @@ Phaser.Animation.prototype = {
387387
this.loopCount++;
388388
this._parent.events.onAnimationLoop$dispatch(this._parent, this);
389389
this.onLoop.dispatch(this._parent, this);
390+
return this.updateCurrentFrame(true);
390391
}
391392
else
392393
{
393394
this.complete();
395+
return false;
394396
}
395397
}
396-
397-
return this.updateCurrentFrame(true);
398-
398+
else
399+
{
400+
return this.updateCurrentFrame(true);
401+
}
399402
}
400403

401404
return false;

0 commit comments

Comments
 (0)