aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Animator.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/api/Animator.cpp
parentc396ae5f78222a7c3547ae5e2ce719ae143acb66 (diff)
parentcc821016c8ddce45a1e3f192415f58be237b8a1e (diff)
Merge branch 'jaro/collision-system' into wouter/exampleGame
Diffstat (limited to 'src/crepe/api/Animator.cpp')
-rw-r--r--src/crepe/api/Animator.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/crepe/api/Animator.cpp b/src/crepe/api/Animator.cpp
index 464b0fd..45f67f6 100644
--- a/src/crepe/api/Animator.cpp
+++ b/src/crepe/api/Animator.cpp
@@ -14,11 +14,14 @@ Animator::Animator(game_object_id_t id, Sprite & ss, int row, int col, int col_a
col(col) {
dbg_trace();
- animator_rect = spritesheet.sprite_rect;
- animator_rect.h /= col;
- animator_rect.w /= row;
- animator_rect.x = 0;
- animator_rect.y = col_animator * animator_rect.h;
+ this->spritesheet.mask.h /= col;
+ this->spritesheet.mask.w /= row;
+ this->spritesheet.mask.x = 0;
+ this->spritesheet.mask.y = col_animator * this->spritesheet.mask.h;
this->active = false;
+
+ // need to do this for to get the aspect ratio for a single clipping in the spritesheet
+ this->spritesheet.aspect_ratio
+ = static_cast<double>(this->spritesheet.mask.w) / this->spritesheet.mask.h;
}
Animator::~Animator() { dbg_trace(); }