ofxSpriteSheetRenderer icon indicating copy to clipboard operation
ofxSpriteSheetRenderer copied to clipboard

playing animations in reverse doesn't work

Open ryleigh opened this issue 13 years ago • 0 comments

When I try to play animations in reverse it gets stuck on the first frame. In ofxSpriteSheetRenderer::addTile, et al:

if(sprite->frame < 0) sprite->frame = sprite->total_frames;
if(sprite->frame >= sprite->total_frames) sprite->frame = 0;

When the first IF is true, sprite->frame is set to sprite->total_frames, which will always cause the second IF to evaluate true, setting sprite->frame back to 0.

Changing the first line to:

if(sprite->frame < 0) sprite->frame = sprite->total_frames - 1;

fixed it for me.

ryleigh avatar May 03 '12 23:05 ryleigh