si el jugador arriba al borde inferior de la habitació i no hi ha conexió, mor

This commit is contained in:
2025-11-21 22:07:53 +01:00
parent 2e1738c20c
commit ec3cc49710

View File

@@ -2,7 +2,7 @@
#include <SDL3/SDL.h>
#include <cmath> // Para std::sqrt, std::min
#include <cmath> // Para std::sqrt, std::min
#include <utility>
#include <vector> // Para vector
@@ -557,10 +557,13 @@ auto Game::changeRoom(const std::string& room_path) -> bool {
// Comprueba si el jugador esta en el borde de la pantalla
void Game::checkPlayerIsOnBorder() {
if (player_->isOnBorder()) {
const std::string ROOM_NAME = room_->getRoom(player_->getBorder());
const auto BORDER = player_->getBorder();
const auto ROOM_NAME = room_->getRoom(BORDER);
if (changeRoom(ROOM_NAME)) {
player_->switchBorders();
spawn_data_ = player_->getSpawnParams();
} else if (BORDER == Room::Border::BOTTOM) {
killPlayer();
}
}
}