Sound effects
|
Yesterday, the 5th January I managed to create sound effects. Since we will use audio like everywhere in our game I decided to initialize the sounds in main.cpp. It could also be initialized in engine but I choosed main for the simplicity, right now main is holding all the important initializes which I think is good practice. If you want to play a sound you can just do this: SoundManager::get(“NAME_OF_SOUND”)->play(6); This will play NAME_OF_SOUND 6 times and if you put nothing as a parameter, it will play only once. And if you put -1 it will play forever until you stop it which you can do with ->stop(); And then in my initialize code: Easy peasy. Also today in the morning I made the music class come to life. |