diff options
-rw-r--r-- | src/crepe/system/AnimatorSystem.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/crepe/system/AnimatorSystem.cpp b/src/crepe/system/AnimatorSystem.cpp index e5ab2fa..0a5a417 100644 --- a/src/crepe/system/AnimatorSystem.cpp +++ b/src/crepe/system/AnimatorSystem.cpp @@ -1,6 +1,7 @@ #include "../api/Animator.h" #include "../manager/ComponentManager.h" #include "../manager/LoopTimerManager.h" +#include "util/Log.h" #include <chrono> #include "AnimatorSystem.h" @@ -29,12 +30,13 @@ void AnimatorSystem::frame_update() { int curr_frame = static_cast<int>(elapsed_time / frame_duration) % total_frames; - ctx.row = ctx.cycle_start + curr_frame; - a.spritesheet.mask.x = ctx.row * a.spritesheet.mask.w; - a.spritesheet.mask.y = (ctx.col * a.spritesheet.mask.h); - if (!ctx.looping && curr_frame == ctx.cycle_start && last_frame == total_frames - 1) { a.active = false; + continue; } + + ctx.row = ctx.cycle_start + curr_frame; + a.spritesheet.mask.x = ctx.row * a.spritesheet.mask.w; + a.spritesheet.mask.y = (ctx.col * a.spritesheet.mask.h); } } |