corregit: bug en Audio::fadeOutMusic quan la musica no es reproduia en bucle

This commit is contained in:
2025-09-25 21:21:39 +02:00
parent abeaf47f96
commit 35f4bf690c
6 changed files with 118 additions and 26 deletions

View File

@@ -117,8 +117,11 @@ Game::~Game() {
auto manager = std::make_unique<ManageHiScoreTable>(Options::settings.hi_score_table);
manager->saveToFile(Asset::get()->get("score.bin"));
Section::attract_mode = Section::AttractMode::TITLE_TO_DEMO;
Audio::get()->stopMusic();
if (Options::audio.enabled) {
// Musica
Audio::get()->stopMusic();
Audio::get()->setMusicVolume(Options::audio.music.volume);
// Sonidos
Audio::get()->stopAllSounds();
Audio::get()->setSoundVolume(Options::audio.sound.volume, Audio::Group::GAME);
}
@@ -1977,6 +1980,12 @@ void Game::handleGameCompletedEvents() {
// Maneja eventos de game over usando flag para trigger único
void Game::handleGameOverEvents() {
static bool game_over_triggered = false;
// Resetear
if (game_over_timer_ == 0.0f) {
game_over_triggered = false;
}
if (!game_over_triggered && game_over_timer_ == 0.0f) {
createMessage({paths_.at(2), paths_.at(3)}, Resource::get()->getTexture("game_text_game_over"));
Audio::get()->fadeOutMusic(1000);