Background Music

This topic contains 5 replies, has 2 voices, and was last updated by  Doug Harper 2 months, 2 weeks ago.

  • July 9, 2016 at 8:35 am #152684

    I set up my Main Menu and Game Over Menu to use Background Music @1 and my Levels to use Background Music #2. When I transition to Game Over the levels music continues playing along with the Game Over music. And… sometimes the same thing happens when I choose Main Menu from the pause screen.

  • July 9, 2016 at 8:49 am #152685

    It’s playing “double music” on the Main/Game Over Menus after I transition from level 1 to level 2. I suspect I need to do something with the cleanupScene(), but backgroundMusicPlayer.stop() isn’t solving it.

    I’m also thinking of doing something to stop the levels background music in my Home.swift didMoveToView just not sure the best thing to do… or if it would even solve the problem.

  • July 9, 2016 at 8:24 pm #152708

    Are you playing the music from the GameViewController?

    • July 9, 2016 at 8:52 pm #152709

      No. I’m playing it in the GameScene controller (controls the levels) and the Home controller (the home menu and game over sks)

  • July 10, 2016 at 2:59 pm #152734

    You might want to try what I do with the kits which is call NSNotifications up to the GameViewController, which is where the only AVAudioPlayer resides. I think one of the reason I started doing that was related to what you’re dealing with now. The other was you could loop an audio track between transitions. So if you wanted the same song playing between scenes, that would support it.

    If you download any of the kits, do a quick search for NSNotification and you’ll see what’s going on. The post notification line sends a Dictionary up to the GameViewController with the filename of what to play (and in some of the kits there might be a little more info sent, like volume).

    If you need some line by line notes, I can help there too.

    • July 11, 2016 at 5:24 pm #152771

      I’ll give that a shot.

      Also… in the completed project download, the tank repeats a 360 when going down.

You must be logged in to reply to this topic.