SFML community forums
Help => Graphics => Topic started by: runizgozilla on June 22, 2014, 11:20:36 pm
-
I'm updating my animation with this line:
animation.setTextureRect(IntRect((frame-1)*16, 0, 16, 16));
Where frame is a number between 0 and 9 and 16 is the width and height of an individual frame of my sprite sheet.
This gives me the first frame and not anything else.
Why doesn't this work?
-
Through experimentation I can now definitely say that if you initialize a texture at the first frame nothing else will be loaded. Sorry for wasting everyone's time the second time in just under 24 hours.
-
Ever considered Thor (http://en.sfml-dev.org/forums/index.php?topic=7329.0)? :D Its animation modules already take care of all this for you, and it's built on top of SFML.
-
If the range of frame is 0-9, I don't think you should be subtracting 1 from it.