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