Sprite::update()
{
if(animation_loops == 0)
+ {
+ if(frame >= get_frames() || frame < 0)
+ frame = 0;
return;
+ }
float frame_inc = (action->fps/1000.0) * (SDL_GetTicks() - last_tick);
last_tick = SDL_GetTicks();
if(animation_reversed)
{
- float excedent = frame - 0;
- if((int)excedent < 0 || excedent >= get_frames())
+ if(frame < 0 || frame >= (float)get_frames())
{ // last case can happen when not used reverse_animation()
+ float excedent = frame - 0;
frame = get_frames() - 1;
if(animation_loops > 0)
{
}
else
{
- float excedent = frame - (get_frames()+1);
- if((int)excedent >= 0)
+ if(frame >= (float)get_frames())
{
+ float excedent = frame - get_frames();
frame = 0;
if(animation_loops > 0)
{