Playing some music

We all know that music is very important in films as it helps immerse viewers in the story, and this happens in video games too. Depending on the game, you will need to transmit different emotions and highlight actions or situations. Luckily, SpriteKit provides us with a group of utilities to play and handle sounds, making these tasks very simple.

Let's start by creating a new group on the project navigator and adding the needed audio resources:

  • Right-click on the InsideTheHat group on the navigator, select New Group, and call it Sound.
  • Right-click on the Sound group and select Add Files to "InsideTheHat"….
  • In the 7338_02_Resources folder, you will find insidethehat_background.mp3, wrong_door.mp3, and correct_door.mp3. Select them ...

Get Getting Started with SpriteKit now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.