summaryrefslogtreecommitdiff
path: root/src/animatedsprite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/animatedsprite.cpp')
-rw-r--r--src/animatedsprite.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index 25525a69..9c82bf7a 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -228,7 +228,7 @@ AnimatedSprite::~AnimatedSprite()
}
void
-AnimatedSprite::play(const std::string& action)
+AnimatedSprite::play(const std::string& action, int time)
{
ActionIterator i = mActions.find(action);
@@ -245,18 +245,10 @@ AnimatedSprite::play(const std::string& action)
mLastTime = 0;
}
- mSpeed = 1.0f;
-}
-
-void
-AnimatedSprite::play(const std::string& action, int time)
-{
- play(action);
-
- if (mAction != NULL)
- {
- Animation *animation = mAction->getAnimation(mDirection);
- int animationLength = animation->getLength();
+ if (!mAction || !time)
+ mSpeed = 1.0f;
+ else {
+ int animationLength = mAction->getAnimation(mDirection)->getLength();
mSpeed = (float) animationLength / time;
}
}