Download Tutorial C Files H Files

dg_animation_update_sprite

This function is used update the sprite following the animation management. Animation DO NOT manage the time !

Usage

void dg_animation_update_sprite(dg_dg_animation_t *animation, sfSprite *sprite, int i);

Example

dg_animation_add(animation, 2);

Source code

void dg_animation_update_sprite(dg_dg_animation_t *animation, sfSprite *sprite, int i)
{
    dg_spritesheet_t *sheet = animation->sheet;
    int frame = animation->frames[(int)(i % animation->size)];
    dg_spritesheet_to_sprite(sheet, sprite, frame);
}