Commit 0bc82d99 authored by Lila NICKLER's avatar Lila NICKLER

Ajout de son quand le joueur perd une vie et ramasse un item

parent 3432c1c6
File added
File added
File added
...@@ -76,6 +76,8 @@ static const int screenWidth = 800; ...@@ -76,6 +76,8 @@ static const int screenWidth = 800;
static const int screenHeight = 450; static const int screenHeight = 450;
static Music music; static Music music;
static Sound sound1;
static Sound sound2;
static bool gameOver = false; static bool gameOver = false;
static bool pause = false; static bool pause = false;
...@@ -117,6 +119,8 @@ int main(void) ...@@ -117,6 +119,8 @@ int main(void)
InitAudioDevice(); InitAudioDevice();
music = LoadMusicStream("music.mp3"); music = LoadMusicStream("music.mp3");
PlayMusicStream(music); PlayMusicStream(music);
sound1 = LoadSound("Hit.mp3");
sound2 = LoadSound("sound2.mp3");
InitGame(); InitGame();
...@@ -139,9 +143,11 @@ int main(void) ...@@ -139,9 +143,11 @@ int main(void)
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadGame(); // Unload loaded data (textures, sounds, models...) UnloadGame(); // Unload loaded data (textures, sounds, models...)
UnloadMusicStream(music); // Unload music stream buffers from RAM UnloadMusicStream(music); // Unload music stream buffers from RAM
UnloadSound(sound1);
UnloadSound(sound2);
CloseAudioDevice();
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
...@@ -418,6 +424,7 @@ void UpdateGame(void) ...@@ -418,6 +424,7 @@ void UpdateGame(void)
enemy[i].rec.x = GetRandomValue(screenWidth, screenWidth + 1000); enemy[i].rec.x = GetRandomValue(screenWidth, screenWidth + 1000);
enemy[i].rec.y = GetRandomValue(0, screenHeight - enemy[i].rec.height); enemy[i].rec.y = GetRandomValue(0, screenHeight - enemy[i].rec.height);
player.life--; player.life--;
PlaySound(sound1);
} }
// Perte du bonus // Perte du bonus
...@@ -438,6 +445,7 @@ void UpdateGame(void) ...@@ -438,6 +445,7 @@ void UpdateGame(void)
{ {
if (CheckCollisionRecs(player.rec, item[i].rec)) if (CheckCollisionRecs(player.rec, item[i].rec))
{ {
PlaySound(sound2);
item[i].active = false; item[i].active = false;
if ( i == ItemNumber -1) if ( i == ItemNumber -1)
{ {
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment