diff --git a/source/game.cpp b/source/game.cpp index c4b9d78..a80cc3e 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -141,7 +141,7 @@ void Game::update() if (mode_ == GameMode::GAME) { player_->update(); - checkPlayerOnBorder(); + checkPlayerIsOnBorder(); checkPlayerAndItems(); checkPlayerAndEnemies(); checkIfPlayerIsAlive(); @@ -326,7 +326,7 @@ bool Game::changeRoom(const std::string &room_path) } // Comprueba si el jugador esta en el borde de la pantalla -void Game::checkPlayerOnBorder() +void Game::checkPlayerIsOnBorder() { if (player_->getOnBorder()) { @@ -661,6 +661,18 @@ void Game::createRoomNameTexture() room_name_rect_ = {0, PLAY_AREA_HEIGHT, options.game.width, text->getCharacterSize() * 2}; } +// Hace sonar la música +void Game::keepMusicPlaying() +{ + const std::string music_path = mode_ == GameMode::GAME ? "game.ogg" : "title.ogg"; + + // Si la música no está sonando + if (JA_GetMusicState() == JA_MUSIC_INVALID || JA_GetMusicState() == JA_MUSIC_STOPPED) + { + JA_PlayMusic(Resource::get()->getMusic(music_path)); + } +} + // DEMO MODE: Inicializa las variables para el modo demo void Game::DEMO_init() { @@ -692,16 +704,4 @@ void Game::DEMO_checkRoomChange() } } } -} - -// Hace sonar la música -void Game::keepMusicPlaying() -{ - const std::string music_path = mode_ == GameMode::GAME ? "game.ogg" : "title.ogg"; - - // Si la música no está sonando - if (JA_GetMusicState() == JA_MUSIC_INVALID || JA_GetMusicState() == JA_MUSIC_STOPPED) - { - JA_PlayMusic(Resource::get()->getMusic(music_path)); - } } \ No newline at end of file diff --git a/source/game.h b/source/game.h index 4ea7df1..1d1bdf3 100644 --- a/source/game.h +++ b/source/game.h @@ -92,7 +92,7 @@ private: void checkInput(); // Comprueba si el jugador esta en el borde de la pantalla y actua - void checkPlayerOnBorder(); + void checkPlayerIsOnBorder(); // Comprueba las colisiones del jugador con los enemigos bool checkPlayerAndEnemies(); @@ -151,15 +151,15 @@ private: // Crea la textura para poner el nombre de la habitación void createRoomNameTexture(); + // Hace sonar la música + void keepMusicPlaying(); + // DEMO MODE: Inicializa las variables para el modo demo void DEMO_init(); // DEMO MODE: Comprueba si se ha de cambiar de habitación void DEMO_checkRoomChange(); - // Hace sonar la música - void keepMusicPlaying(); - public: // Constructor explicit Game(GameMode mode);