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

@@ -37,8 +37,6 @@ void Notify::render()
{
notifications.at(i).sprite->render();
}
text->write(8,8,"TEXTO DE PRUEBA");
}
// Actualiza el estado de las notificaiones

View File

@@ -59,7 +59,7 @@ Director::Director(int argc, char *argv[])
music = JA_LoadMusic(asset->get("title.ogg").c_str());
// Inicializa los servicios online
initOnline();
//initOnline();
}
Director::~Director()

View File

@@ -232,6 +232,7 @@ void Game::update()
checkIfPlayerIsAlive();
checkGameOver();
checkEndGame();
checkRestoringJail();
scoreboard->update();
input->update();
@@ -601,3 +602,21 @@ void Game::switchPause()
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);
}
}

View File

@@ -127,6 +127,9 @@ private:
// Pone el juego en pausa
void switchPause();
// Da vidas al jugador cuando está en la Jail
void checkRestoringJail();
public:
// Constructor
Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, Input *input, Debug *debug);