varios ajustos

This commit is contained in:
2024-08-13 18:51:55 +02:00
parent a2ce1f0dc3
commit 3f3242393e
3 changed files with 13 additions and 10 deletions

View File

@@ -860,7 +860,7 @@ void Director::runTitle()
// Ejecuta la seccion de juego donde se juega
void Director::runGame()
{
const int playerID = section->subsection == SUBSECTION_GAME_PLAY_1P ? 1 : 2;
const int playerID = section->subsection == SUBSECTION_GAME_PLAY_1P ? 0 : 1;
game = new Game(playerID, 0, screen, asset, lang, input, false, param, options, section, getMusic(musics, "playing.ogg"));
game->run();
delete game;
@@ -885,7 +885,7 @@ void Director::runInstructions()
// Ejecuta el juego en modo demo
void Director::runDemoGame()
{
const int playerID = (rand() % 2) + 1;
const int playerID = rand() % 2;
demoGame = new Game(playerID, 0, screen, asset, lang, input, true, param, options, section, nullptr);
demoGame->run();
delete demoGame;

View File

@@ -112,8 +112,11 @@ void Game::init(int playerID)
Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 30, playerTextures[1], playerAnimations);
players.push_back(player2);
// Habilita el jugador seleccionado. playerID es player 1 o player 2
players[playerID - 1]->enable(true);
// Habilita el jugador seleccionado
players[playerID]->enable(true);
// Como es el principio del juego, empieza sin inmunidad
players[playerID]->setInvulnerable(false);
// Variables relacionadas con la dificultad
switch (difficulty)
@@ -153,6 +156,7 @@ void Game::init(int playerID)
{
scoreboard->setMode(SCOREBOARD_RIGHT_PANEL, SCOREBOARD_MODE_GAME_OVER);
}
scoreboard->setMode(SCOREBOARD_CENTER_PANEL, SCOREBOARD_MODE_STAGE_INFO);
// Resto de variables
paused = false;
@@ -205,8 +209,8 @@ void Game::init(int playerID)
// Activa o no al otro jugador
if (rand() % 2 == 0)
{
const int otherPlayer = playerID == 1 ? 2 : 1;
players[otherPlayer - 1]->enable(true);
const int otherPlayer = playerID == 1 ? 1 : 0;
players[otherPlayer]->enable(true);
}
for (auto player : players)
@@ -214,7 +218,7 @@ void Game::init(int playerID)
// Añade 0, 1 o 2 cafes al jugador
for (int i = 0; i < rand() % 3; ++i)
{
player->giveExtraHit();
//player->giveExtraHit();
}
// Empieza sin inmunidad

View File

@@ -214,7 +214,7 @@ void Scoreboard::fillPanelTextures()
SDL_SetRenderTarget(renderer, panelTexture[i]);
// Dibuja el fondo de la textura
SDL_SetRenderDrawColor(renderer, i * 64, 0, 0, 255);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
SDL_RenderClear(renderer);
switch (panel[i].mode)
@@ -283,7 +283,6 @@ void Scoreboard::fillBackgroundTexture()
// Dibuja el fondo del marcador
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255);
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
SDL_RenderFillRect(renderer, nullptr);
// Copia las texturas de los paneles