aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AnimatorSystem.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-28 13:01:07 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-28 13:01:14 +0100
commit63bce3dd21c82e2b4e45c07934d5a26684cdaa93 (patch)
treea46da0cb575fa21add7b07f2784c7889e4bc2771 /src/crepe/system/AnimatorSystem.cpp
parent2a2a3391ff0b449602825c3182af33c2ff52abc0 (diff)
parent85aa57e33d493502b05984ce44db6c68f627a6f2 (diff)
merge `master`
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 cdeac57..57ee6e2 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;
}
}