From f56837fc6cc11ac1cc3cb389063ec77aa762f408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Sun, 7 May 2023 10:07:06 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adido=20sonido=20al=20sprite=20de=20la?= =?UTF-8?q?=20demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 9e9e81b..a83cedd 100644 --- a/main.cpp +++ b/main.cpp @@ -64,10 +64,10 @@ int main(int argc, char *argv[]) JA_Init(48000, AUDIO_S16, 2); JA_Music_t *music; - JA_Sound_t *peiv; + JA_Sound_t *sound; music = JA_LoadMusic(asset->get("music.ogg").c_str()); - peiv = JA_LoadSound(asset->get("sound.wav").c_str()); + sound = JA_LoadSound(asset->get("sound.wav").c_str()); int volume = 128; // Inicializa el texto @@ -124,10 +124,12 @@ int main(int argc, char *argv[]) if (sprite->getPosX() + sprite->getWidth() > options->gameWidth or sprite->getPosX() < 0) { sprite->setVelX(sprite->getVelX() * -1); + JA_PlaySound(sound); } if (sprite->getPosY() + sprite->getHeight() > options->gameHeight or sprite->getPosY() < 0) { sprite->setVelY(sprite->getVelY() * -1); + JA_PlaySound(sound); } sprite->update(); } @@ -165,7 +167,7 @@ int main(int argc, char *argv[]) delete text; // Finaliza jail_audio - JA_DeleteSound(peiv); + JA_DeleteSound(sound); JA_DeleteMusic(music); // Finaliza el objeto con la lista de recuros