summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-05-27 14:24:31 +0300
committerAndrei Karas <akaras@inbox.ru>2012-05-27 14:24:31 +0300
commit6b92b52308211bc61320e3c8062c59e7b4e81f65 (patch)
treed3688346aa54b9e7f8df621367bf448aa788c38c
parentd855b71675c61b5583347a3824de492f50f3e0eb (diff)
downloadmanaplus-6b92b52308211bc61320e3c8062c59e7b4e81f65.tar.gz
manaplus-6b92b52308211bc61320e3c8062c59e7b4e81f65.tar.bz2
manaplus-6b92b52308211bc61320e3c8062c59e7b4e81f65.tar.xz
manaplus-6b92b52308211bc61320e3c8062c59e7b4e81f65.zip
Fix incorrect reset animation.
-rw-r--r--src/animatedsprite.cpp7
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();
}