mes edge merdes
This commit is contained in:
@@ -325,6 +325,26 @@ void Game::updatePlaying(float delta_time) {
|
||||
#else
|
||||
player_->update(delta_time);
|
||||
#endif
|
||||
// Si durante una transición el jugador cruza de vuelta por el borde opuesto,
|
||||
// abortar la transición y volver a la habitación anterior
|
||||
if (transitioning_ && player_->isOnBorder()) {
|
||||
const auto BORDER = player_->getBorder();
|
||||
const bool FELL_BACK =
|
||||
(transition_direction_ == Room::Border::TOP && BORDER == Room::Border::BOTTOM) ||
|
||||
(transition_direction_ == Room::Border::BOTTOM && BORDER == Room::Border::TOP) ||
|
||||
(transition_direction_ == Room::Border::LEFT && BORDER == Room::Border::RIGHT) ||
|
||||
(transition_direction_ == Room::Border::RIGHT && BORDER == Room::Border::LEFT);
|
||||
|
||||
if (FELL_BACK) {
|
||||
room_ = transition_old_room_;
|
||||
player_->setRoom(room_);
|
||||
player_->switchBorders();
|
||||
spawn_data_ = player_->getSpawnParams();
|
||||
current_room_ = transition_old_room_path_;
|
||||
setScoreBoardColor();
|
||||
endTransition();
|
||||
}
|
||||
}
|
||||
checkPlayerIsOnBorder();
|
||||
checkPlayerAndItems();
|
||||
checkPlayerAndEnemies();
|
||||
@@ -816,6 +836,7 @@ void Game::checkPlayerIsOnBorder() {
|
||||
|
||||
// Guardar la habitación saliente
|
||||
transition_old_room_ = room_;
|
||||
transition_old_room_path_ = current_room_;
|
||||
transition_direction_ = BORDER;
|
||||
|
||||
// Crear nueva habitación y reposicionar jugador
|
||||
@@ -844,6 +865,7 @@ void Game::endTransition() {
|
||||
transition_just_ended_ = true;
|
||||
transition_timer_ = 0.0F;
|
||||
transition_old_room_.reset();
|
||||
transition_old_room_path_.clear();
|
||||
transition_direction_ = Room::Border::NONE;
|
||||
Screen::get()->setRenderOffset(0, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user