aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AnimatorSystem.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-01 15:05:28 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-01 15:05:28 +0100
commit5981ab2262a98b80a1339f86a6b71093576a9b35 (patch)
tree325ff71fc2482a6960656f0ced80db874945a938 /src/crepe/system/AnimatorSystem.cpp
parent4d6d5a6ff5366877cbc7b8e24110b56a332a7353 (diff)
parent647eb8e318f1ed1e3ec18505ea4df57025e6ffd5 (diff)
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/gameloop
Diffstat (limited to 'src/crepe/system/AnimatorSystem.cpp')
-rw-r--r--src/crepe/system/AnimatorSystem.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/crepe/system/AnimatorSystem.cpp b/src/crepe/system/AnimatorSystem.cpp
index 676e485..4c40940 100644
--- a/src/crepe/system/AnimatorSystem.cpp
+++ b/src/crepe/system/AnimatorSystem.cpp
@@ -15,10 +15,10 @@ void AnimatorSystem::update() {
uint64_t tick = SDLContext::get_instance().get_ticks();
for (Animator & a : animations) {
- if (a.active) {
- 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.mask.x = (a.curr_row * a.spritesheet.mask.w) + a.curr_col;
+ a.spritesheet.mask = a.spritesheet.mask;
}
}