Retocado el final del ending con fade de audio

This commit is contained in:
2022-11-04 18:36:08 +01:00
parent 332b3f5286
commit d37b21fc3b
6 changed files with 46 additions and 8 deletions

View File

@@ -212,6 +212,7 @@ void Game::update()
checkPlayerAndItems();
checkPlayerAndEnemies();
checkIfPlayerIsAlive();
checkGameOver();
checkEndGame();
scoreboard->update();
input->update();
@@ -372,7 +373,7 @@ void Game::checkIfPlayerIsAlive()
}
// Comprueba si ha terminado la partida
void Game::checkEndGame()
void Game::checkGameOver()
{
if (board.lives < 0)
{
@@ -497,4 +498,20 @@ void Game::setScoreBoardColor()
// Si el color es negro brillante lo cambia a blanco
const color_t cBrightBlack = stringToColor(options->palette, "bright_black");
board.color = colorAreEqual(c, cBrightBlack) ? stringToColor(options->palette, "white") : c;
}
// Comprueba si ha finalizado el juego
bool Game::checkEndGame()
{
const bool a = room->getName() == "THE JAIL";
const bool b = board.items >= 2;
const bool c = player->getRect().x < 152;
if (a && b && c)
{
section.name = SECTION_PROG_ENDING;
return true;
}
return false;
}