diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2025-01-06 11:27:23 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2025-01-06 11:27:23 +0100 |
commit | a9fba4fa1fc348cdbbd60e9bda58b62b35019380 (patch) | |
tree | ff0d4c33f34573c7b44c17902dd953a56d4e4799 /src/crepe/system/AnimatorSystem.cpp | |
parent | c35a53ff122d9ea3547ef8ae6035bd9e1b10d4cb (diff) | |
parent | 958475050c80addf584b6a166649c337c68a879f (diff) |
Merge branch 'niels/UI' of github.com:lonkaars/crepe into jaro/main-menu
Diffstat (limited to 'src/crepe/system/AnimatorSystem.cpp')
-rw-r--r-- | src/crepe/system/AnimatorSystem.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/crepe/system/AnimatorSystem.cpp b/src/crepe/system/AnimatorSystem.cpp index 1a0cde9..ec9a445 100644 --- a/src/crepe/system/AnimatorSystem.cpp +++ b/src/crepe/system/AnimatorSystem.cpp @@ -34,14 +34,15 @@ void AnimatorSystem::frame_update() { int total_frames = cycle_end - ctx.cycle_start; int curr_cycle_frame = (a.frame - ctx.cycle_start) % total_frames; + if (!ctx.looping && a.frame >= cycle_end) { + a.active = false; + continue; + } + ctx.row = (ctx.cycle_start + curr_cycle_frame) % a.grid_size.x; ctx.col = curr_cycle_frame / a.grid_size.x; a.spritesheet.mask.x = ctx.row * a.spritesheet.mask.w; a.spritesheet.mask.y = ctx.col * a.spritesheet.mask.y; - - if (!ctx.looping && a.frame >= cycle_end) { - a.active = false; - } } } |