Añadida pantalla de game over funcional

This commit is contained in:
2022-11-06 14:48:02 +01:00
parent ec5da9ae3e
commit 0cb83657be
4 changed files with 28 additions and 15 deletions

View File

@@ -40,7 +40,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
// Inicializa el resto de variables
ticks = 0;
ticksSpeed = 15;
board.lives = 9;
board.lives = 2;
board.items = 0;
board.rooms = 1;
board.music = true;
@@ -372,7 +372,7 @@ void Game::checkGameOver()
{
if (board.lives < 0)
{
section.name = SECTION_PROG_TITLE;
section.name = SECTION_PROG_GAME_OVER;
}
}
@@ -410,7 +410,7 @@ void Game::killPlayer()
this->player->pause();
// Deshabilita las entradas hasta que no haya ninguna activa
input->disableUntil(d_keyPressed);
//input->disableUntil(d_keyPressed);
}
// Recarga todas las texturas
@@ -458,7 +458,7 @@ void Game::updateBlackScreen()
if (blackScreen)
{
blackScreenCounter++;
if (blackScreenCounter > 10)
if (blackScreenCounter > 20)
{
blackScreen = false;
blackScreenCounter = 0;
@@ -498,10 +498,9 @@ void Game::setScoreBoardColor()
// Comprueba si ha finalizado el juego
bool Game::checkEndGame()
{
const bool a = room->getName() == "THE JAIL"; // Estar en la habitación que toca
const bool b = board.items >= totalItems * 0.9f; // Con mas del 90% de los items recogidos
const bool c = player->getRect().x <= 128; // Estar en la ubicación que toca (En la puerta)
const bool a = room->getName() == "THE JAIL"; // Estar en la habitación que toca
const bool b = board.items >= int(totalItems * 0.9f); // Con mas del 90% de los items recogidos
const bool c = player->getRect().x <= 128; // Y en la ubicación que toca (En la puerta)
if (b)
{