If you don't preload sounds, there is a delay before the sound plays for the first time. This tutorial shows how to preload sounds.
- [Instructor] As we talked about earlier in this chapter,…there's an issue if you just play sound effects…without preloading them,…that makes them pause your application…while the sound is loading,…the first time the sound plays.…So, in my application here I'm going to show how…to solve that issue by preloading sounds.…So, I have some sounds that are already playing.…Like this laser sound.…Then I have my explosion sound playing as well.…So that's right here.…And let's go up to didMove(to view:…And in here I'm going to preload my sounds.…
The first thing that you want to do…when you're preloading sounds is…to import AVFoundation.…So make sure you include that line of code at the top.…And then inside of didMove(to view:…I'm going to create a do statement.…Now the reason why we have to create a do statement is…because creating an AV audio player, the object that's going…to preload our sounds, throws errors.…So, we need to make sure we put this…inside of a do statement.…So, let's say we want to load…in the explosion sound and the laser sound.…
- Creating a SpriteKit project
- Adding and modifying sprites
- Creating sprites in code
- Transitioning between scenes
- Working with children and parents
- Adding physics
- Detecting and responding to collisions
- Applying particle effects
- Creating actions
- Working with sound
- Adding cameras and lights
Skill Level Intermediate
Game Design Careers with Brenda Romerowith Brenda Romero54m 41s Beginner
Careers in the Game Industrywith Christian Bradley1h 19m Beginner
Building a Game App with the Android SDKwith David Gassner2h 6m Intermediate
1. Introduction to SpriteKit
2. Add Physics
3. Work with Particle Effects
4. Work with Actions
5. Work with Audio
6. Additional Features
Next steps1m 41s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.