From a93a723db62ba2ad445b0fff26be5c51aefcda78 Mon Sep 17 00:00:00 2001 From: Chuck Miller Date: Sun, 3 May 2009 17:11:25 -0400 Subject: Added rotational particles, and added code to show arrows when a player shoots them. --- src/simpleanimation.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/simpleanimation.cpp') diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index 65d8e8e2..7038f446 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -129,6 +129,16 @@ void SimpleAnimation::reset() mAnimationPhase = 0; } +void SimpleAnimation::setFrame(int frame) +{ + if (frame < 0) + frame = 0; + if (frame >= mAnimation->getLength()) + frame = mAnimation->getLength() - 1; + mAnimationPhase = frame; + mCurrentFrame = mAnimation->getFrame(mAnimationPhase); +} + void SimpleAnimation::update(unsigned int timePassed) { mAnimationTime += timePassed; @@ -145,6 +155,11 @@ void SimpleAnimation::update(unsigned int timePassed) } } +int SimpleAnimation::getLength() +{ + return mAnimation->getLength(); +} + Image *SimpleAnimation::getCurrentImage() const { return mCurrentFrame->image; -- cgit v1.2.3-70-g09d2