fix: la inmunitat del jugador no funcionava

This commit is contained in:
2024-07-25 18:13:34 +02:00
parent cff1df19c2
commit 18eab9fe0d
3 changed files with 24 additions and 32 deletions

View File

@@ -311,16 +311,16 @@ void Game::init(int playerID)
players[otherPlayer - 1]->enable(true);
}
// Añade 0, 1 o 2 cafes al jugador 1
for (int i = 0; i < rand() % 3; ++i)
for (auto player : players)
{
players[0]->giveExtraHit();
}
// Añade 0, 1 o 2 cafes al jugador
for (int i = 0; i < rand() % 3; ++i)
{
player->giveExtraHit();
}
// Añade 0, 1 o 2 cafes al jugador 2
for (int i = 0; i < rand() % 3; ++i)
{
players[1]->giveExtraHit();
// Empieza sin inmunidad
player->setInvulnerable(false);
}
// Deshabilita los sonidos
@@ -2453,7 +2453,7 @@ void Game::renderSmartSprites()
// Acciones a realizar cuando el jugador muere
void Game::killPlayer(Player *player)
{
if (!player->isEnabled() && player->isInvulnerable())
if (!player->isEnabled() || player->isInvulnerable())
{ // Si no está habilitado o tiene inmunidad, no hace nada
return;
}