From a5a3bb23dabdb14f47ae73218b19201f77d7d3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Tue, 13 Aug 2024 23:01:48 +0200 Subject: [PATCH] =?UTF-8?q?4=20putes=20merdes=20que=20no=20han=20servit=20?= =?UTF-8?q?pa=20res.=20Au=20dem=C3=A0=20mirar=C3=A9=20qu=C3=A9=20passa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/game.cpp | 13 ++++++++++--- source/player.cpp | 5 +++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/source/game.cpp b/source/game.cpp index 07a13d5..f3ca0dc 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -1957,7 +1957,7 @@ void Game::update() #endif // Comprueba si la música ha de estar sonando - checkMusicStatus(); + // checkMusicStatus(); // Actualiza el objeto screen screen->update(); @@ -2100,6 +2100,12 @@ void Game::render() // Dibuja el separador del marcador de la zona de juego renderSeparator(); +#ifdef DEBUG + text->write(0, 0, boolToString(players[0]->isAlive())); + text->write(0, 10, boolToString(players[1]->isAlive())); + text->write(0, 20, "POLLA"); +#endif + // Dibuja el fade fade->render(); @@ -2450,7 +2456,7 @@ void Game::checkMusicStatus() // Reproduce la música if (!gameCompleted) { - if (players[0]->isAlive() || players[1]->isAlive()) + if (!allPlayersAreDead()) { JA_PlayMusic(music); } @@ -2630,7 +2636,8 @@ bool Game::allPlayersAreDead() bool success = true; for (auto player : players) { - success &= (!player->isAlive() || !player->isEnabled()); + // success &= (!player->isAlive() || !player->isEnabled()); + success &= !player->isAlive(); } return success; diff --git a/source/player.cpp b/source/player.cpp index 3d175fb..4b56489 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -35,7 +35,7 @@ void Player::init() // Inicializa variables de estado posX = defaultPosX; posY = defaultPosY; - alive = true; + alive = enabled; statusWalking = PLAYER_STATUS_WALKING_STOP; statusFiring = PLAYER_STATUS_FIRING_NO; invulnerable = true; @@ -302,7 +302,8 @@ void Player::setScore(Uint32 score) // Incrementa la puntuación del jugador void Player::addScore(Uint32 score) { - if (enabled && alive) + //if (enabled && alive) + if (alive) { this->score += score; }