fix: ja no salta per pasillos estrets. early return antes d'startJump
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user