mes edge merdes
This commit is contained in:
@@ -325,6 +325,26 @@ void Game::updatePlaying(float delta_time) {
|
|||||||
#else
|
#else
|
||||||
player_->update(delta_time);
|
player_->update(delta_time);
|
||||||
#endif
|
#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();
|
checkPlayerIsOnBorder();
|
||||||
checkPlayerAndItems();
|
checkPlayerAndItems();
|
||||||
checkPlayerAndEnemies();
|
checkPlayerAndEnemies();
|
||||||
@@ -816,6 +836,7 @@ void Game::checkPlayerIsOnBorder() {
|
|||||||
|
|
||||||
// Guardar la habitación saliente
|
// Guardar la habitación saliente
|
||||||
transition_old_room_ = room_;
|
transition_old_room_ = room_;
|
||||||
|
transition_old_room_path_ = current_room_;
|
||||||
transition_direction_ = BORDER;
|
transition_direction_ = BORDER;
|
||||||
|
|
||||||
// Crear nueva habitación y reposicionar jugador
|
// Crear nueva habitación y reposicionar jugador
|
||||||
@@ -844,6 +865,7 @@ void Game::endTransition() {
|
|||||||
transition_just_ended_ = true;
|
transition_just_ended_ = true;
|
||||||
transition_timer_ = 0.0F;
|
transition_timer_ = 0.0F;
|
||||||
transition_old_room_.reset();
|
transition_old_room_.reset();
|
||||||
|
transition_old_room_path_.clear();
|
||||||
transition_direction_ = Room::Border::NONE;
|
transition_direction_ = Room::Border::NONE;
|
||||||
Screen::get()->setRenderOffset(0, 0);
|
Screen::get()->setRenderOffset(0, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ class Game {
|
|||||||
float transition_timer_{0.0F}; // Tiempo transcurrido en la transición
|
float transition_timer_{0.0F}; // Tiempo transcurrido en la transición
|
||||||
std::shared_ptr<Room> transition_old_room_; // Habitación saliente (se mantiene viva durante la transición)
|
std::shared_ptr<Room> transition_old_room_; // Habitación saliente (se mantiene viva durante la transición)
|
||||||
Room::Border transition_direction_{Room::Border::NONE}; // Dirección de la transición
|
Room::Border transition_direction_{Room::Border::NONE}; // Dirección de la transición
|
||||||
|
std::string transition_old_room_path_; // Path de la habitación saliente (para poder restaurarla)
|
||||||
bool transition_just_ended_{false}; // Cooldown de 1 frame tras finalizar transición
|
bool transition_just_ended_{false}; // Cooldown de 1 frame tras finalizar transición
|
||||||
|
|
||||||
// Variables de demo mode
|
// Variables de demo mode
|
||||||
|
|||||||
Reference in New Issue
Block a user