Skip to content

Commit 1340d32

Browse files
authored
Merge pull request phaserjs#2871 from hilts-vaughan/issue-2822
Animation: Fixes an issue where setFrame would skip a frame if the an…
2 parents 34080ed + 8673918 commit 1340d32

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

v2-community/src/animation/Animation.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,9 @@ Phaser.Animation.prototype = {
320320

321321
if (frameIndex)
322322
{
323-
// Set the current frame index to the found index. Subtract 1 so that it animates to the desired frame on update.
324-
this._frameIndex = frameIndex - 1;
323+
// Set the current frame index to the found index. Subtract a directional offset so that it animates to the desired frame on update.
324+
var directionalOffset = this.isReversed ? -1 : 1;
325+
this._frameIndex = frameIndex - directionalOffset;
325326

326327
// Make the animation update at next update
327328
this._timeNextFrame = this.game.time.time;

0 commit comments

Comments
 (0)