From 80e80ddccb640ea5ffc3a2826eb57b4c26ab83e4 Mon Sep 17 00:00:00 2001 From: XekeDeath Date: Mon, 30 Sep 2013 13:04:22 +1000 Subject: [PATCH] Make animation looping robust when skipping frames. --- src/animation/Animation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/animation/Animation.js b/src/animation/Animation.js index a5e8d271..da486f01 100644 --- a/src/animation/Animation.js +++ b/src/animation/Animation.js @@ -208,7 +208,7 @@ Phaser.Animation.prototype = { { if (this.looped) { - this._frameIndex = this._frameIndex - this._frames.length; + this._frameIndex = this._frameIndex %= this._frames.length; this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]); this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); this._parent.events.onAnimationLoop.dispatch(this._parent, this);