style: organitzada la capçalera de Room

This commit is contained in:
2025-10-29 09:58:49 +01:00
parent cd836862c0
commit 8bf9da5fb6
7 changed files with 453 additions and 542 deletions

View File

@@ -117,22 +117,22 @@ void Player::checkInput(float delta_time) {
// Comprueba si está situado en alguno de los cuatro bordes de la habitación
void Player::checkBorders() {
if (x_ < PLAY_AREA_LEFT) {
border_ = RoomBorder::LEFT;
border_ = Room::Border::LEFT;
is_on_border_ = true;
}
else if (x_ + WIDTH > PLAY_AREA_RIGHT) {
border_ = RoomBorder::RIGHT;
border_ = Room::Border::RIGHT;
is_on_border_ = true;
}
else if (y_ < PLAY_AREA_TOP) {
border_ = RoomBorder::TOP;
border_ = Room::Border::TOP;
is_on_border_ = true;
}
else if (y_ + HEIGHT > PLAY_AREA_BOTTOM) {
border_ = RoomBorder::BOTTOM;
border_ = Room::Border::BOTTOM;
is_on_border_ = true;
}
@@ -179,21 +179,21 @@ void Player::checkState(float delta_time) {
// Cambia al jugador de un borde al opuesto. Util para el cambio de pantalla
void Player::switchBorders() {
switch (border_) {
case RoomBorder::TOP:
case Room::Border::TOP:
y_ = PLAY_AREA_BOTTOM - HEIGHT - BLOCK;
setState(State::STANDING);
break;
case RoomBorder::BOTTOM:
case Room::Border::BOTTOM:
y_ = PLAY_AREA_TOP;
setState(State::STANDING);
break;
case RoomBorder::RIGHT:
case Room::Border::RIGHT:
x_ = PLAY_AREA_LEFT;
break;
case RoomBorder::LEFT:
case Room::Border::LEFT:
x_ = PLAY_AREA_RIGHT - WIDTH;
break;
@@ -561,7 +561,7 @@ auto Player::checkKillingTiles() -> bool {
// Comprueba si hay contacto con algún tile que mata
if (std::ranges::any_of(collider_points_, [this](const auto& c) {
return room_->getTile(c) == TileType::KILL;
return room_->getTile(c) == Room::Tile::KILL;
})) {
is_alive_ = false; // Mata al jugador inmediatamente
return true; // Retorna en cuanto se detecta una colisión