public:
explicit AnimationRunner(const Animation *a = 0, int colOffset = 0, int rowOffset = 0)
- : animation(a), sprite(0), colOffset(colOffset), rowOffset(rowOffset) { }
+ : animation(a), sprite(0), frameShift(0), colOffset(colOffset), rowOffset(rowOffset) { }
public:
bool Valid() const { return animation; }
const app::Timer<Uint32> &GetTimer() { return timer; }
+ void SetFrameShift(int offset) { frameShift = offset; }
+ int FrameShift() const { return frameShift; }
void SetColOffset(int offset) { colOffset = offset; }
int ColOffset() const { return colOffset; }
void SetRowOffset(int offset) { rowOffset = offset; }
Draw(dest, position + offset);
}
- int Frame() const { return Running() ? (timer.Iteration() % animation->NumFrames()) : 0; }
+ int Frame() const { return Running() ? ((timer.Iteration() + frameShift) % animation->NumFrames()) : 0; }
private:
const Animation *animation;
const graphics::Sprite *sprite;
app::Timer<Uint32> timer;
+ int frameShift;
int colOffset;
int rowOffset;