diff --git a/data/music/game_over.ogg b/data/music/game_over.ogg new file mode 100755 index 0000000..7f68a2d Binary files /dev/null and b/data/music/game_over.ogg differ diff --git a/source/director.cpp b/source/director.cpp index ad6d130..835f119 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -1206,6 +1206,7 @@ bool Director::setFileList() asset->add("/data/music/loading_sound3.ogg", t_music); asset->add("/data/music/ending1.ogg", t_music); asset->add("/data/music/ending2.ogg", t_music); + asset->add("/data/music/game_over.ogg", t_music); // Efectos de sonido asset->add("/data/sound/item.wav", t_sound); diff --git a/source/game_over.cpp b/source/game_over.cpp index ba6d4d7..e8bc995 100644 --- a/source/game_over.cpp +++ b/source/game_over.cpp @@ -15,6 +15,7 @@ GameOver::GameOver(SDL_Renderer *renderer, Screen *screen, Resource *resource, A text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer); playerSprite = new AnimatedSprite(renderer, resource->getAnimation("player_game_over.ani")); tvSprite = new AnimatedSprite(renderer, resource->getAnimation("tv.ani")); + music = JA_LoadMusic(asset->get("game_over.ogg").c_str()); // Inicializa variables counter = 0; @@ -47,6 +48,7 @@ GameOver::~GameOver() delete text; delete playerSprite; delete tvSprite; + JA_DeleteMusic(music); } // Actualiza el objeto @@ -71,6 +73,12 @@ void GameOver::update() // Actualiza el contador counter++; + // Hace sonar la música + if (counter == 30) + { + JA_PlayMusic(music, 0); + } + // Comprueba si ha terminado la sección if (counter == endSection) { diff --git a/source/game_over.h b/source/game_over.h index 7c81a0c..829dd82 100644 --- a/source/game_over.h +++ b/source/game_over.h @@ -39,6 +39,7 @@ private: int endSection; // Contador: cuando acaba la sección int iniFade; // Contador: cuando emiepza el fade int fadeLenght; // Contador: duración del fade + JA_Music music; // Musica que suena durante el juego // Actualiza el objeto void update();