Make animation looping robust when skipping frames.

This commit is contained in:
XekeDeath
2013-09-30 13:04:22 +10:00
parent 29dbbcae52
commit 80e80ddccb
+1 -1
View File
@@ -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);