Sound Effects, File I/O, and Finishing the Game
We are nearly done with this project. This short chapter will demonstrate how we can easily manipulate files stored on the hard drive using the C++ Standard Library, and we will also add sound effects. Of course, we know how to add sound effects, but we will discuss exactly where the calls to the play
function will go in the code. We will also tie up a few loose ends to make the game complete.
In this chapter, we will cover the following topics:
- Saving and loading the high score
- Preparing sound effects
- Allowing the player to level up and spawning a new wave
- Restarting the game
- Playing the rest of the sounds