From 93f5ef70fd3395b843adf59b5be4c34a26a78a4f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 12 Mar 2015 17:29:53 -0400 Subject: Added death sound effect --- res/Hit_Hurt5.wav | Bin 0 -> 18866 bytes src/components.cpp | 2 ++ src/game.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 res/Hit_Hurt5.wav diff --git a/res/Hit_Hurt5.wav b/res/Hit_Hurt5.wav new file mode 100644 index 0000000..8442fec Binary files /dev/null and b/res/Hit_Hurt5.wav differ diff --git a/src/components.cpp b/src/components.cpp index 941d02e..9f37771 100644 --- a/src/components.cpp +++ b/src/components.cpp @@ -573,6 +573,8 @@ bool MapCollisionComponent::processCollision(Game& game, Entity& collider, Colli Message msg(Message::Type::die); collider.send(game, msg); + playSound("../res/Hit_Hurt5.wav"); + game.schedule(FRAMES_PER_SECOND * 0.75, [&] () { game.loadGame(map); }); diff --git a/src/game.h b/src/game.h index cea154a..ca6c00b 100644 --- a/src/game.h +++ b/src/game.h @@ -33,7 +33,6 @@ class Game { void loadGame(const Map& curMap); void schedule(int frames, std::function&& callback); - bool shouldQuit = false; private: friend void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods); @@ -45,6 +44,7 @@ class Game { Map m2{"../maps/second.txt"}; Savefile save; std::list>> scheduled; + bool shouldQuit = false; }; #endif -- cgit 1.4.1