Solved 1P death music. Some tweaks to bg.png

This commit is contained in:
2021-08-29 22:55:19 +02:00
parent 224b176108
commit 384cfa7156
5 changed files with 37 additions and 21 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1737,10 +1737,10 @@ void Game::updateStage()
void Game::updateDeath() void Game::updateDeath()
{ {
// Comprueba si todos los jugadores estan muertos // Comprueba si todos los jugadores estan muertos
bool allPlayersAreDead = true; bool allAreDead = true;
for (int i = 0; i < mNumPlayers; i++) for (int i = 0; i < mNumPlayers; i++)
{ {
allPlayersAreDead &= (!mPlayer[i]->isAlive()); allAreDead &= (!mPlayer[i]->isAlive());
if (!mPlayer[i]->isAlive()) if (!mPlayer[i]->isAlive())
{ {
@@ -1776,9 +1776,9 @@ void Game::updateDeath()
} }
} }
if (allPlayersAreDead) if (allAreDead)
{ {
JA_StopMusic(); //JA_StopMusic();
if (mDeathCounter > 0) if (mDeathCounter > 0)
{ {
@@ -2530,14 +2530,18 @@ void Game::killPlayer(int index)
} }
else else
{ {
JA_PauseMusic();
stopAllBalloons(10); stopAllBalloons(10);
//JA_StopMusic();
JA_PlaySound(mSoundPlayerCollision); JA_PlaySound(mSoundPlayerCollision);
shakeScreen(); shakeScreen();
SDL_Delay(500); SDL_Delay(500);
JA_PlaySound(mSoundCoffeeOut); JA_PlaySound(mSoundCoffeeOut);
throwPlayer(mPlayer[index]->getPosX(), mPlayer[index]->getPosY(), index); throwPlayer(mPlayer[index]->getPosX(), mPlayer[index]->getPosY(), index);
mPlayer[index]->setAlive(false); mPlayer[index]->setAlive(false);
if (allPlayersAreDead())
JA_StopMusic();
else
JA_ResumeMusic();
} }
} }
} }
@@ -3479,3 +3483,13 @@ void Game::updateHelper()
mHelper.needCoffeeMachine = false; mHelper.needCoffeeMachine = false;
} }
} }
// Comprueba si todos los jugadores han muerto
bool Game::allPlayersAreDead()
{
bool success = true;
for (int i = 0; i < mNumPlayers; i++)
success &= (!mPlayer[i]->isAlive());
return success;
}

View File

@@ -212,13 +212,6 @@ private:
}; };
debug_t mDebug; debug_t mDebug;
public:
// Constructor
Game(int numPlayers, SDL_Renderer *renderer, std::string *filelist, Lang *lang, Input *input, bool demo, options_t *options);
// Destructor
~Game();
// Inicializa el vector con los valores del seno // Inicializa el vector con los valores del seno
void initSin(); void initSin();
@@ -255,9 +248,6 @@ public:
// Aumenta el poder de la fase // Aumenta el poder de la fase
void increaseStageCurrentPower(Uint8 power); void increaseStageCurrentPower(Uint8 power);
// Establece el valor de la variable
//void setScore(Uint32 score);
// Establece el valor de la variable // Establece el valor de la variable
void setHiScore(Uint32 score); void setHiScore(Uint32 score);
@@ -477,9 +467,6 @@ public:
// Agita la pantalla // Agita la pantalla
void shakeScreen(); void shakeScreen();
// Bucle para el juego
section_t run();
// Bucle para el menu de pausa del juego // Bucle para el menu de pausa del juego
void runPausedGame(); void runPausedGame();
@@ -503,6 +490,19 @@ public:
// Actualiza las variables de ayuda // Actualiza las variables de ayuda
void updateHelper(); void updateHelper();
// Comprueba si todos los jugadores han muerto
bool allPlayersAreDead();
public:
// Constructor
Game(int numPlayers, SDL_Renderer *renderer, std::string *filelist, Lang *lang, Input *input, bool demo, options_t *options);
// Destructor
~Game();
// Bucle para el juego
section_t run();
}; };
#endif #endif

View File

@@ -640,6 +640,7 @@ void Player::setInvulnerableCounter(Uint16 value)
void Player::updateInvulnerableCounter() void Player::updateInvulnerableCounter()
{ {
if (mInvulnerable) if (mInvulnerable)
{
if (mInvulnerableCounter > 0) if (mInvulnerableCounter > 0)
{ {
mInvulnerableCounter--; mInvulnerableCounter--;
@@ -649,6 +650,7 @@ void Player::updateInvulnerableCounter()
mInvulnerable = false; mInvulnerable = false;
mInvulnerableCounter = PLAYER_INVULNERABLE_COUNTER; mInvulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
} }
}
} }
// Actualiza el valor de la variable // Actualiza el valor de la variable

View File

@@ -221,8 +221,8 @@ void Title::init(bool demo, Uint8 subsection)
// Crea el mosaico de fondo del titulo // Crea el mosaico de fondo del titulo
createTiledBackground(); createTiledBackground();
mBackgroundWindow.x = 0; mBackgroundWindow.x = 128;
mBackgroundWindow.y = 0; mBackgroundWindow.y = 96;
mBackgroundWindow.w = SCREEN_WIDTH; mBackgroundWindow.w = SCREEN_WIDTH;
mBackgroundWindow.h = SCREEN_HEIGHT; mBackgroundWindow.h = SCREEN_HEIGHT;