Ya muere al caer de alto

This commit is contained in:
2022-09-15 17:01:56 +02:00
parent d53f2695a0
commit 8ad496b510
5 changed files with 33 additions and 0 deletions

View File

@@ -188,6 +188,7 @@ void Game::update()
checkPlayerOnBorder();
checkPlayerAndItems();
checkPlayerAndEnemies();
checkIfPlayerIsAlive();
scoreboard->update();
updateDebugInfo();
}
@@ -330,6 +331,15 @@ void Game::checkPlayerAndItems()
room->itemCollision(player->getCollider());
}
// Comprueba si el jugador esta vivo
void Game::checkIfPlayerIsAlive()
{
if (!player->isAlive())
{
killPlayer();
}
}
// Mata al jugador
void Game::killPlayer()
{