diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-27 14:24:31 +0300 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-02-22 22:19:22 +0100 |
commit | 46e5338fc2f341bca9e3be1994ebf3067b0c7cb9 (patch) | |
tree | 2eecb8c8de7a2dc6aecdf529ae3b1117902cbf10 | |
parent | 2f5c1467be6f46de659763e90c5d209c63e320b2 (diff) | |
download | mana-46e5338fc2f341bca9e3be1994ebf3067b0c7cb9.tar.gz mana-46e5338fc2f341bca9e3be1994ebf3067b0c7cb9.tar.bz2 mana-46e5338fc2f341bca9e3be1994ebf3067b0c7cb9.tar.xz mana-46e5338fc2f341bca9e3be1994ebf3067b0c7cb9.zip |
Fix incorrect reset animation.
Cherry-picked from M+ commit 6b92b52308211bc61320e3c8062c59e7b4e81f65.
-rw-r--r-- | src/sprite.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sprite.cpp b/src/sprite.cpp index 9a329754..1e8f9923 100644 --- a/src/sprite.cpp +++ b/src/sprite.cpp @@ -59,6 +59,10 @@ bool Sprite::reset() mFrameIndex = 0; mFrameTime = 0; + if (mAnimation) + mFrame = mAnimation->getFrame(0); + else + mFrame = nullptr; return ret; } @@ -74,8 +78,6 @@ bool Sprite::play(const std::string &spriteAction) if (animation && animation != mAnimation && animation->getLength() > 0) { mAnimation = animation; - mFrame = mAnimation->getFrame(0); - reset(); return true; @@ -160,7 +162,6 @@ bool Sprite::setDirection(SpriteDirection direction) if (animation && animation != mAnimation && animation->getLength() > 0) { mAnimation = animation; - mFrame = mAnimation->getFrame(0); reset(); } |