Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Game with Sprite Kit Artificial Intelligence and Sound Adding Background Music

Maarten Tolhuijs
Maarten Tolhuijs
13,349 Points

Background Music Volume

If anybody is like me and thought the background music was a little bit too loud to be enjoyable, here is the code to adjust it to your liking!

Just add:

[self.backgroundMusic setVolume:0.7]; //setVolume to anything between 0.0 and 1.0

What I did looked like this: (and works for me by the way...)

- (void) didMoveToView:(SKView *)view {
    [self.backgroundMusic play];
    [self.backgroundMusic setVolume:0.7];
}