fix(player): el disparador del HURT en aterrar usa la hit-box, no la base-box

This commit is contained in:
JailDesigner committed 2026-04-25 15:01:56 +02:00
1 parent e8407ce35e
commit 7f78f556f3
1 file changed
+9 -7
+9 -7
View File
@@ -669,13 +669,15 @@ void Player::resolveLandingOverlap() {
if (all_players_ == nullptr) { return; } if (all_players_ == nullptr) { return; }
for (Player* other : *all_players_) { for (Player* other : *all_players_) {
if (other == nullptr || other == this) { continue; } if (other == nullptr || other == this) { continue; }
// Test amb la BASE-box (cos sencer): si els cossos solapen, // Test amb la hit-box (8×8 de contacte precís), no la base-box.
// l'altre es projecta. Usem la base-box i no la hit-box perquè // Coherent amb la resta de col·lisions actor-actor del joc:
// ens importa la separació visual completa, no només els // momies, fuetades futures, resolver PvP… tots usen hit-box. Un
// píxels de contacte. // aterratge "rozant" (cossos solapats però els punts de contacte
const SDL_FRect MY_BOX = getBaseBox(); // separats) no dispara HURT — el frame següent els dos estan a
const SDL_FRect OT_BOX = other->getBaseBox(); // terra i la col·lisió normal els gestiona.
if (!SDL_HasRectIntersectionFloat(&MY_BOX, &OT_BOX)) { continue; } const SDL_FRect MY_HIT = getHitBox();
const SDL_FRect OT_HIT = other->getHitBox();
if (!SDL_HasRectIntersectionFloat(&MY_HIT, &OT_HIT)) { continue; }
other->enterHurt(); other->enterHurt();
} }
} }