diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-02 21:00:54 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-02 21:00:54 +0100 |
commit | 0a1739de21e5ab270cb45efb6fc0aed092d81227 (patch) | |
tree | ab4019d595fce2410c5ca5d0fd98ad6d8205c079 /src/crepe/system/AnimatorSystem.cpp | |
parent | a84ca09e97d466643f022acfffcf4c6a77f42052 (diff) |
added all the contructor strutcts for animator,sprite and camera
Diffstat (limited to 'src/crepe/system/AnimatorSystem.cpp')
-rw-r--r-- | src/crepe/system/AnimatorSystem.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/crepe/system/AnimatorSystem.cpp b/src/crepe/system/AnimatorSystem.cpp index b1f23d1..ff8d2ce 100644 --- a/src/crepe/system/AnimatorSystem.cpp +++ b/src/crepe/system/AnimatorSystem.cpp @@ -4,7 +4,6 @@ #include "AnimatorSystem.h" #include "ComponentManager.h" -#include <iostream> using namespace crepe; @@ -21,7 +20,7 @@ void AnimatorSystem::update() { Animator::Data & ctx = a.data; double frame_duration = 1.0f / ctx.fps; - int cycle_end = (ctx.cycle_end == -1) ? ctx.row : cycle_end; + int cycle_end = (ctx.cycle_end == -1) ? ctx.row : ctx.cycle_end; int total_frames = cycle_end - ctx.cycle_start; int curr_frame = static_cast<int>(elapsed_time / frame_duration) % total_frames; @@ -30,8 +29,7 @@ void AnimatorSystem::update() { ctx.spritesheet.mask.x = ctx.curr_row * ctx.spritesheet.mask.w; ctx.spritesheet.mask.y = (ctx.curr_col * ctx.spritesheet.mask.h); - std::cout << curr_frame << " " << total_frames << std::endl; - if (!ctx.looping && curr_frame == 0) { + if (!ctx.looping && curr_frame == total_frames - 1) { a.active = false; } } |