Añadida opción para intercambiar los jugadores de los dos primeros mandos

This commit is contained in:
2024-09-11 13:59:40 +02:00
parent ecf34558f4
commit 3d41da0fdf
5 changed files with 55 additions and 38 deletions

View File

@@ -122,11 +122,14 @@ void Game::init(int playerID)
player2->setController(controller2);
players.push_back(player2);
// Obtiene el "id" del jugador que va a jugar
Player *player = getPlayer(playerID);
// Cambia el estado del jugador seleccionado
players[playerID]->setStatusPlaying(PLAYER_STATUS_PLAYING);
player->setStatusPlaying(PLAYER_STATUS_PLAYING);
// Como es el principio del juego, empieza sin inmunidad
players[playerID]->setInvulnerable(false);
player->setInvulnerable(false);
// Variables relacionadas con la dificultad
switch (difficulty)
@@ -224,8 +227,9 @@ void Game::init(int playerID)
// Activa o no al otro jugador
if (rand() % 2 == 0)
{
const int otherPlayer = playerID == 1 ? 1 : 0;
players[otherPlayer]->setStatusPlaying(PLAYER_STATUS_PLAYING);
const int otherPlayer = playerID == 1 ? 2 : 1;
Player *player = getPlayer(otherPlayer);
player->setStatusPlaying(PLAYER_STATUS_PLAYING);
}
for (auto player : players)