aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AnimatorSystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/system/AnimatorSystem.cpp')
-rw-r--r--src/crepe/system/AnimatorSystem.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/crepe/system/AnimatorSystem.cpp b/src/crepe/system/AnimatorSystem.cpp
index bc94253..e5b277f 100644
--- a/src/crepe/system/AnimatorSystem.cpp
+++ b/src/crepe/system/AnimatorSystem.cpp
@@ -15,11 +15,10 @@ void AnimatorSystem::update() {
uint64_t tick = SDLContext::get_instance().get_ticks();
for (Animator & a : animations) {
- if (a.active) {
- // (10 frames per second)
- a.curr_row = (tick / 100) % a.row;
- a.animator_rect.x = (a.curr_row * a.animator_rect.w) + a.curr_col;
- a.spritesheet.sprite_rect = a.animator_rect;
- }
+ if (!a.active) continue;
+ // (10 frames per second)
+ a.curr_row = (tick / 100) % a.row;
+ a.spritesheet.sprite_rect.x = (a.curr_row * a.spritesheet.sprite_rect.w) + a.curr_col;
+ a.spritesheet.sprite_rect = a.spritesheet.sprite_rect;
}
}