Sound effects and music are very important in modern games. I am sure you can remember some recent popular game where the "Better with headphones" sign appears on the splash screen.
Many games just would not be that good without the atmosphere created with sound effects and music. In this chapter, we will learn how to add them to our game. We will add sound effects when we shoot the arrow, hit the bird, and in other places where you would expect to hear sounds in the real world. In addition to this, we are going to make our game even cooler by adding some background music.
In this chapter, we will cover the following topics:
Playing sound effects
Playing music and background sounds
Switching between music tracks
Making use of stereo headphones
Finding sound effects for our game
Adding sound effects and preloading them