fix: bug mileanri que deixava al jugador atascat en algunes rampes en certes condicions
This commit is contained in:
@@ -136,6 +136,10 @@ void Player::transitionToState(State state) {
|
||||
handleDeathByFalling();
|
||||
resetSoundControllersOnLanding();
|
||||
updateCurrentSlope();
|
||||
if (current_slope_ == nullptr) {
|
||||
// Los pies no coinciden con ninguna rampa: tratar como suelo plano
|
||||
state_ = State::ON_GROUND;
|
||||
}
|
||||
break;
|
||||
case State::JUMPING:
|
||||
// Puede saltar desde ON_GROUND o ON_SLOPE
|
||||
@@ -248,14 +252,15 @@ void Player::moveOnSlope(float delta_time) {
|
||||
// Determinama cuál debe ser la velocidad a partir de automovement o de wanna_go_
|
||||
updateVelocity();
|
||||
|
||||
if (vx_ == 0.0F) { return; }
|
||||
|
||||
// Verificar que tenemos una rampa válida
|
||||
// Verificar rampa válida antes de comprobar velocidad: si no hay rampa siempre caer,
|
||||
// independientemente de si hay o no input (evita bloqueo con vx_=0 y slope null)
|
||||
if (current_slope_ == nullptr) {
|
||||
transitionToState(State::FALLING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (vx_ == 0.0F) { return; }
|
||||
|
||||
// Determinar el tipo de rampa
|
||||
const bool IS_LEFT_SLOPE = isLeftSlope();
|
||||
|
||||
@@ -588,6 +593,7 @@ void Player::updateCurrentSlope() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (current_slope_ != nullptr) {
|
||||
Debug::get()->set("sl.type", isLeftSlope() ? "L\\" : "R/");
|
||||
|
||||
Reference in New Issue
Block a user