diff --git a/src/corelib/physics.c b/src/corelib/physics.c index f9ee2b4..bd41676 100644 --- a/src/corelib/physics.c +++ b/src/corelib/physics.c @@ -43,10 +43,15 @@ int _rect_overlap(float aminx, float aminy, float amaxx, float amaxy, float bmin static inline short _collision_aabb_aabb(const object_t* a, const object_t* b) { - const float aminx = a->physics.aabb.x + a->sprite.x, aminy = a->physics.aabb.y + a->sprite.x; - const float amaxx = aminx + a->physics.aabb.w, amaxy = aminy + a->physics.aabb.h; - const float bminx = b->physics.aabb.x, bminy = b->physics.aabb.y; - const float bmaxx = b->physics.aabb.x + b->physics.aabb.w, bmaxy = b->physics.aabb.y + b->physics.aabb.h; + const float aminx = a->physics.aabb.x + a->sprite.x, + aminy = a->physics.aabb.y + a->sprite.y; + const float amaxx = aminx + a->physics.aabb.w, + amaxy = aminy + a->physics.aabb.h; + + const float bminx = b->physics.aabb.x + b->sprite.x, + bminy = b->physics.aabb.y + b->sprite.y; + const float bmaxx = bminx + b->physics.aabb.w, + bmaxy = bminy + b->physics.aabb.h; return _rect_overlap(aminx, aminy, amaxx, amaxy, bminx, bminy, bmaxx, bmaxy); }