feat(player): hit-box 8×8 per a contacte actor-actor (player, momia, trampa)

This commit is contained in:
JailDesigner committed 2026-04-24 19:23:30 +02:00
1 parent 511f8d5b09
commit 858e444842
6 files changed
+84 -8

No files matched your search

+7 -2
View File
@@ -98,8 +98,13 @@ namespace {
auto* b = ps[1];
if (a == nullptr || b == nullptr) { return; }
const SDL_FRect BOX_A = a->getBaseBox();
const SDL_FRect BOX_B = b->getBaseBox();
// Calculem l'overlap previst en l'espai de la hit-box petita:
// els jugadors han de poder acostar-se molt (caixes de moviment
// 16×16 quasi tocant) sense disparar el resolver; només quan el
// contacte real (hit-box 8×8) s'activaria, neutralitzem o apliquem
// push.
const SDL_FRect BOX_A = a->getHitBox();
const SDL_FRect BOX_B = b->getHitBox();
const SDL_FRect NEXT_A{
.x = BOX_A.x + (a->getIntendedVX() * dt),
.y = BOX_A.y + (a->getIntendedVY() * dt),