fixos en la plataforma mobil

This commit is contained in:
2026-04-08 17:39:19 +02:00
parent 3db74ebd4d
commit 88a822c562
8 changed files with 395 additions and 240 deletions

View File

@@ -84,9 +84,10 @@ auto PlatformManager::checkPlayerOnPlatform(const SDL_FRect& player_collider, fl
float player_feet = player_collider.y + player_collider.h;
float platform_top = plat_rect.y;
// Tolerancia de 4px (medio tile) para compensar el movimiento entre frames
// Tolerancia bidireccional de 4px para compensar el movimiento entre frames
// (cuando la plataforma baja, los pies quedan por encima del top momentáneamente)
constexpr float TOLERANCE = 4.0F;
if (player_feet >= platform_top && player_feet <= platform_top + TOLERANCE) {
if (player_feet >= platform_top - TOLERANCE && player_feet <= platform_top + TOLERANCE) {
return platform.get();
}
}