background music playing while changing scene?

FViMaginationFViMagination Member Posts: 89
edited April 2012 in Working with GS (Mac)
Hi everybody,
quick question: how do I keep the background music playing while changing scenes in a game? Is it possible to do it or should I make my game with a unique scene?
As an example, I've seen that Zombie Drop game has background music playing without interruptions while changing game levels and I would like to have the same thing into my game.
thanks!

Best Answers

  • stackpoolestackpoole Melbourne, Victoria, AustraliaPosts: 473
    Accepted Answer
    Hi

    It should keep playing, if it is already playing,
    unless there is a rule you made to stop it

    Sydney Swans 2014!!

  • 921creative921creative Posts: 140
    Accepted Answer
    Any time you have a "Play Music" behavior called out in a rule, the music will start from the beginning. The only way to not have the music start again is to remove the behavior from Scene 2. Problem is, when you go back to Scene 1, the music will start from the beginning again because you have the behavior called out in Scene 1. You need a game attribute that checks whether music is playing ("true"), and if it is false, Play Music, then set the attribute to true.

Answers

  • FViMaginationFViMagination Member Posts: 89
    Hi

    It should keep playing, if it is already playing,
    unless there is a rule you made to stop it
    unfortunately it doesn't work like that... I mean, I put an Actor into a first scene that keeps playing Music, but when I change scene, even having the same Actor into the second scene, the music played by Scene 1 gets interrupted and it starts again from the beginning on Scene 2...
  • EatingMyHatEatingMyHat Member Posts: 1,246
    Are you playing Music or Sound? Sound will stop, Music will not.

    Also, do you have a Play Music behavior on Scene2?



    Follow Eating My Hat on Facebook, Twitter and our Blog
    Check out my templates in the GS Marketplace or at the store
  • FViMaginationFViMagination Member Posts: 89
    Are you playing Music or Sound? Sound will stop, Music will not.

    Also, do you have a Play Music behavior on Scene2?

    yes, I have an Actor in Scene 1 with Plays Music (not a Sound) behavior, and I have the same Actor into Scene 2, but when I go from Scene 1 to 2 Music starts again from the beginning...
  • FViMaginationFViMagination Member Posts: 89
    thanks 921!
    And where should I put that game.Attribute that checks whether music is playing or not? I have now a Music Actor that has a Play Music behavior in Scene 1 only, and a boolean game Attribute called MusicPlaying (which is false)...
  • 921creative921creative Member, PRO Posts: 140
    edited May 2012
    The Play Music behavior should be in a rule in every scene.

    When Attribute "game.MusicPlaying" = false
    [ Play Music ]
    Change Attribute game.MusicPlaying to true

    That way the music will continue playing as you go from scene to scene and will only start from the beginning if the music is not already playing.
  • FViMaginationFViMagination Member Posts: 89
    perfect, it works great!
    thanks 921, I appreciate your help
Sign In or Register to comment.