In this chapter, we have covered the basic topics for dealing with audio in 2D games. We saw how the concepts are implemented using SFML classes and functions. In particular, we played different music themes depending on the application state. We also created sound effects for various in-game events, and positioned them in the world in order to enable a spatial audition.
With this knowledge, you are now able to incorporate audio into your game; a crucial component for creating an immersive gaming experience. As you have seen during this chapter, SFML makes the implementation very simple. The actual challenge is the fine-tuning and the combination of suitable sound effects and music themes in order to create a unique atmosphere.
The audio functionality completes the attempt to create a playable game that uses different sources of media. However, so far, only one player can play it. In the next chapter, we are going to improve the situation by adding multiplayer support.