Sprite::Sprite(SpriteData& newdata)
: data(newdata), frame(0), animation_loops(-1)
{
- action = data.actions.begin()->second;
+ action = data.get_action("normal");
+ if(!action)
+ action = data.actions.begin()->second;
last_ticks = SDL_GetTicks();
}
frame += frame_inc;
- if(frame > get_frames()) {
+ if(frame >= get_frames()) {
frame = fmodf(frame+get_frames(), get_frames());
animation_loops--;