Chapter 10. Adding sound effects
We now have a fully functional game with scores. It is time to add some sound effects. This is fairly easy to do using Sprite Kit in Swift. Every game has to have background music, so we will see how to add audio and what design patterns we can use to control the audio. We will not only add background music, but we will also look at adding some sound effects for our character when he has acquired a power up or when he dies.
In this chapter we will learn how to add sound to our game using:
AVAudioPlayer is part of the AVFoundation framework, which is used when dealing with audio and video in iOS or Mac OS X. It makes it easy to play audio and provides you with fine tune controlling.