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

View File

@@ -1737,10 +1737,10 @@ void Game::updateStage()
void Game::updateDeath()
{
// Comprueba si todos los jugadores estan muertos
bool allPlayersAreDead = true;
bool allAreDead = true;
for (int i = 0; i < mNumPlayers; i++)
{
allPlayersAreDead &= (!mPlayer[i]->isAlive());
allAreDead &= (!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)
{
@@ -2530,14 +2530,18 @@ void Game::killPlayer(int index)
}
else
{
JA_PauseMusic();
stopAllBalloons(10);
//JA_StopMusic();
JA_PlaySound(mSoundPlayerCollision);
shakeScreen();
SDL_Delay(500);
JA_PlaySound(mSoundCoffeeOut);
throwPlayer(mPlayer[index]->getPosX(), mPlayer[index]->getPosY(), index);
mPlayer[index]->setAlive(false);
if (allPlayersAreDead())
JA_StopMusic();
else
JA_ResumeMusic();
}
}
}
@@ -3478,4 +3482,14 @@ void Game::updateHelper()
mHelper.needCoffee = 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;
}