fix: al canviar de pantalla lateralment, es resetejava la altura de salt i el jugador caia
This commit is contained in:
@@ -85,6 +85,7 @@ void Player::move(float delta_time) {
|
||||
#ifdef _DEBUG
|
||||
Debug::get()->add(std::string("X : " + std::to_string(static_cast<int>(x_))));
|
||||
Debug::get()->add(std::string("Y : " + std::to_string(static_cast<int>(y_))));
|
||||
Debug::get()->add(std::string("LGP: " + std::to_string(static_cast<int>(last_grounded_position_))));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -393,11 +394,15 @@ void Player::switchBorders() {
|
||||
switch (border_) {
|
||||
case Room::Border::TOP:
|
||||
y_ = PLAY_AREA_BOTTOM - HEIGHT - TILE_SIZE;
|
||||
// CRÍTICO: Resetear last_grounded_position_ para evitar muerte falsa por diferencia de Y entre pantallas
|
||||
last_grounded_position_ = static_cast<int>(y_);
|
||||
transitionToState(State::ON_GROUND); // TODO: Detectar si debe ser ON_SLOPE
|
||||
break;
|
||||
|
||||
case Room::Border::BOTTOM:
|
||||
y_ = PLAY_AREA_TOP;
|
||||
// CRÍTICO: Resetear last_grounded_position_ para evitar muerte falsa por diferencia de Y entre pantallas
|
||||
last_grounded_position_ = static_cast<int>(y_);
|
||||
transitionToState(State::ON_GROUND); // TODO: Detectar si debe ser ON_SLOPE
|
||||
break;
|
||||
|
||||
@@ -413,8 +418,6 @@ void Player::switchBorders() {
|
||||
break;
|
||||
}
|
||||
|
||||
// CRÍTICO: Resetear last_grounded_position_ para evitar muerte falsa por diferencia de Y entre pantallas
|
||||
last_grounded_position_ = static_cast<int>(y_);
|
||||
is_on_border_ = false;
|
||||
placeSprite();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user