diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-27 14:24:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-27 14:24:31 +0300 |
commit | 6b92b52308211bc61320e3c8062c59e7b4e81f65 (patch) | |
tree | d3688346aa54b9e7f8df621367bf448aa788c38c | |
parent | d855b71675c61b5583347a3824de492f50f3e0eb (diff) | |
download | mv-6b92b52308211bc61320e3c8062c59e7b4e81f65.tar.gz mv-6b92b52308211bc61320e3c8062c59e7b4e81f65.tar.bz2 mv-6b92b52308211bc61320e3c8062c59e7b4e81f65.tar.xz mv-6b92b52308211bc61320e3c8062c59e7b4e81f65.zip |
Fix incorrect reset animation.
-rw-r--r-- | src/animatedsprite.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 136bea946..9bf7018a3 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -84,6 +84,10 @@ bool AnimatedSprite::reset() mFrameTime = 0; mLastTime = 0; + if (mAnimation) + mFrame = mAnimation->getFrame(0); + else + mFrame = nullptr; return ret; } @@ -102,8 +106,6 @@ bool AnimatedSprite::play(std::string spriteAction) if (animation && animation != mAnimation && animation->getLength() > 0) { mAnimation = animation; - mFrame = mAnimation->getFrame(0); - reset(); return true; @@ -252,7 +254,6 @@ bool AnimatedSprite::setSpriteDirection(SpriteDirection direction) if (animation && animation != mAnimation && animation->getLength() > 0) { mAnimation = animation; - mFrame = mAnimation->getFrame(0); reset(); } |