aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AnimatorSystem.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-03 11:33:48 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-03 11:33:48 +0100
commitd1a31a3cafc9aadb047509f5cd8b2befa212add8 (patch)
treeaf43d7e3bd55818565fb253064d3f35a44786a68 /src/crepe/system/AnimatorSystem.cpp
parentc396ae5f78222a7c3547ae5e2ce719ae143acb66 (diff)
parentcc821016c8ddce45a1e3f192415f58be237b8a1e (diff)
Merge branch 'jaro/collision-system' into wouter/exampleGame
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;
}
}