Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- attack_time += delta;
- while(attack_time >= attack_delay)
- {
- attack_time -= attack_delay;
- attack_anim_active = true;
- }
- if(attack_anim_active)
- {
- float percent = attack_time / attack_delay;
- int index_from_percent = (int)roundf(percent, attack_sprites.count);
- sprite = attack_sprites[index_from_percent];
- if(sprite == attack_sprites[attack_sprites.count - 1]) { attack_anim_active = false; }
- }
- else
- {
- sprite = default_sprite_or_whatever;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement