Cuendo el jugador entra a la Jail, recupera todas sus vidas

This commit is contained in:
2022-11-19 09:22:10 +01:00
parent e90c61a416
commit 3fa7657c79
4 changed files with 23 additions and 3 deletions

View File

@@ -232,6 +232,7 @@ void Game::update()
checkIfPlayerIsAlive();
checkGameOver();
checkEndGame();
checkRestoringJail();
scoreboard->update();
input->update();
@@ -600,4 +601,22 @@ void Game::switchPause()
scoreboard->pause();
paused = true;
}
}
// Da vidas al jugador cuando está en la Jail
void Game::checkRestoringJail()
{
if (room->getName() != "THE JAIL" || board.lives == 9)
{
return;
}
static int counter = 0;
counter++;
if (counter == 100)
{
counter = 0;
board.lives++;
JA_PlaySound(deathSound);
}
}