fix: ja no salta per pasillos estrets. early return antes d'startJump

This commit is contained in:
2026-04-10 12:44:02 +02:00
parent 97c30bf9a1
commit 12ace89890

View File

@@ -194,6 +194,13 @@ void Player::handleJumpAndDrop() {
if (state_ == State::ON_AIR) { return; } if (state_ == State::ON_AIR) { return; }
if (wanna_jump_) { if (wanna_jump_) {
// No saltar si hay techo justo encima (pasillo de altura justa).
// Sin esta comprobación se reproducían sonido de salto + landing y un frame
// de salto antes de colisionar inmediatamente con el techo.
const auto& tc = room_->getTileCollider();
if (tc.checkCeiling(x_, y_ - 1, WIDTH) != Collision::NONE) {
return;
}
startJump(); startJump();
return; return;
} }