fixed typos and mismatched statements in aabb-aabb collision

pull/17/head
Sara 2023-07-16 20:53:41 +02:00
parent 763c43aed6
commit 0dc35bd9d9
1 changed files with 9 additions and 4 deletions

View File

@ -43,10 +43,15 @@ int _rect_overlap(float aminx, float aminy, float amaxx, float amaxy, float bmin
static inline static inline
short _collision_aabb_aabb(const object_t* a, const object_t* b) { 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 aminx = a->physics.aabb.x + a->sprite.x,
const float amaxx = aminx + a->physics.aabb.w, amaxy = aminy + a->physics.aabb.h; aminy = a->physics.aabb.y + a->sprite.y;
const float bminx = b->physics.aabb.x, bminy = b->physics.aabb.y; const float amaxx = aminx + a->physics.aabb.w,
const float bmaxx = b->physics.aabb.x + b->physics.aabb.w, bmaxy = b->physics.aabb.y + b->physics.aabb.h; 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); return _rect_overlap(aminx, aminy, amaxx, amaxy, bminx, bminy, bmaxx, bmaxy);
} }