diff --git a/media/gfx/game_bg.png b/media/gfx/game_bg.png index 766b05d..35b72c1 100644 Binary files a/media/gfx/game_bg.png and b/media/gfx/game_bg.png differ diff --git a/source/game.cpp b/source/game.cpp index 59f980a..bd3291b 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -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; } \ No newline at end of file diff --git a/source/game.h b/source/game.h index b11a1ed..da4939e 100644 --- a/source/game.h +++ b/source/game.h @@ -191,7 +191,7 @@ private: Uint8 mDifficulty; // Dificultad del juego float mDifficultyScoreMultiplier; // Multiplicador de puntos en función de la dificultad struct options_t *mOptions; // Variable con todas las variables de las opciones del programa - Uint8 mOnePlayerControl; // Variable para almacenar el valor de las opciones + Uint8 mOnePlayerControl; // Variable para almacenar el valor de las opciones struct demo_t { @@ -212,13 +212,6 @@ private: }; 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 void initSin(); @@ -255,9 +248,6 @@ public: // Aumenta el poder de la fase void increaseStageCurrentPower(Uint8 power); - // Establece el valor de la variable - //void setScore(Uint32 score); - // Establece el valor de la variable void setHiScore(Uint32 score); @@ -477,9 +467,6 @@ public: // Agita la pantalla void shakeScreen(); - // Bucle para el juego - section_t run(); - // Bucle para el menu de pausa del juego void runPausedGame(); @@ -503,6 +490,19 @@ public: // Actualiza las variables de ayuda 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 diff --git a/source/player.cpp b/source/player.cpp index 7479ef4..66f2873 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -640,6 +640,7 @@ void Player::setInvulnerableCounter(Uint16 value) void Player::updateInvulnerableCounter() { if (mInvulnerable) + { if (mInvulnerableCounter > 0) { mInvulnerableCounter--; @@ -649,6 +650,7 @@ void Player::updateInvulnerableCounter() mInvulnerable = false; mInvulnerableCounter = PLAYER_INVULNERABLE_COUNTER; } + } } // Actualiza el valor de la variable diff --git a/source/title.cpp b/source/title.cpp index 14aab99..df5c160 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -221,8 +221,8 @@ void Title::init(bool demo, Uint8 subsection) // Crea el mosaico de fondo del titulo createTiledBackground(); - mBackgroundWindow.x = 0; - mBackgroundWindow.y = 0; + mBackgroundWindow.x = 128; + mBackgroundWindow.y = 96; mBackgroundWindow.w = SCREEN_WIDTH; mBackgroundWindow.h = SCREEN_HEIGHT;