Music that loops forever - even between scenes?

xGrapexGrape Member Posts: 5
edited March 2012 in Working with GS (Mac)
Hi all, my first post!

I have a game with 2 scenes, a game scene and a game over scene. In the game scene I have an actor that plays background music, looping. When the game over scene is shown, the music is still playing. Pressing a button in the game over scene, switches back to the first scene for a new try at the game - but this time the music starts over. Any way to change this, and just have the music keep on playing regardless of scene, never starting over (just looping)? Thanks for any and all help :)

Comments

  • POMPOM Member Posts: 2,599
    edited March 2012
    Yes , the way i do it is i use a boolean called "game.music started"

    In my menu scene
    When "game.music started" IS false
    Start music - loop
    change "game.music started" TO true .

    This way next time it will not start again from the beginning ..

    Photobucket Roy
  • ChobbifaceChobbiface PRO Posts: 491
    edited March 2012
    Hi xGrape, welcome to Gamesalad if you're new, and welcome anyway if you've just been lurking :P

    I presume you have the play music behaviour in your game scene? - Which is why it triggers new each time you get to that scene. You'll need an attribute with it.

    Make a boolean attribute e.g. called MusicOn (leave off as default):

    In your game scene, rule: when MusicOn = false > Play music and change attribute MusicOn to true
    In otherwise section of rule (i.e. MusicOn is true/music is already playing): resume music (in play music behaviour)

    Edit: as Roy says, you don't even need the otherwise section of the rule actually, it would only be useful if you had different music files to play

    Cheers

  • xGrapexGrape Member Posts: 5
    Thanks to the both of you, that did the trick! And yes, I have been lurking for a couple weeks ;) So still fairly new I would say.
  • CloudsClouds Member Posts: 1,599
    edited March 2012
    Gives me an idea . . . . .

    It would be handy if there was an off switch or a simple 'destroy rule' rule !

    You place it after your rule and once the rule has been executed it is switched off or deleted for the rest of the game.

    Or maybe an option within each rule that says: Use Once.
  • POMPOM Member Posts: 2,599
    edited March 2012
    @Tynan
    Basically you can make this "Use Once" thing with a boolean within 1 minute , but a good suggestion to give an option to use a rule only once , you should suggest it to GS .

    Photobucket Roy
  • CloudsClouds Member Posts: 1,599
    edited March 2012
    @Tynan
    Basically you can make this "Use Once" thing with a boolean within 1 minute
    Yep, good point, your above example is essentially a 'Use Once' command, I just thought it would be convenient to have it as a little button at the top of every rule.
    you should suggest it to GS .
    I always get the feeling that sending GS suggestions and bug reports and so on is like throwing stuff into a black hole, you never even know if they've even bothered to read what you posted, no feedback gives people the idea that no one is listening on the other end of the line, I just do my moaning about bugs on the forum now :(( ;)
Sign In or Register to comment.