GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Have music playing constantly through main menu, settings, achievements. then BACK to main NO RESET.

Hey, I'm having a hard time with this one. First of all, WICKED forums. Thanks for ALL the answers that people have been given. I've solved a lot of problems already. Now here is one I need help with.

I've got a MAIN MENU (where play button, settings button, achievements button, etc is located - first screen seen when game is open).

Now, I've figured out how to have music play on startup, and when a user clicks on settings, or achievements, BUT, when they hit the back button to go BACK TO MAIN, the music RESTARTS. DO NOT WANT. I want the music to play fluently, constantly until the user decides to pick LEVEL 1 from the level's menu...

I've already tried making a new scene BEFORE the MAIN MENU scene, and having the music start here (named it "music start scene", and the scene only appears for 0.01 seconds), but then when the player decides to play a couple levels, and go back to the MAIN MENU, the music will not play, because the music loading scene didn't load.......

...

I literally just thought of the answer to my own question as I was typing this out, but I guess I will continue for those that may be lost in the same retrospect.

When a user clicks the back button to go back to the MAIN MENU screen, simply make it so that the back button points to the "music loading screen" instead....

Have a good one, everybody. lol... Such a weird thread. My apologies.

Comments

  • HopscotchHopscotch Posts: 2,782Member, PRO

    @JodyMitoma‌ , you could also have a game.Attribute with which you track whether music has been started already or not.

    On the menu scene have a rule

    Rule: Attribute game.MusicPlaying = False 
    
             Play Music
    
             game.MusicPlaying = True
    
    end of rule
    
  • JodyMitomaJodyMitoma Posts: 307Member
    edited April 2014

    @Hopscotch said:
    JodyMitoma‌ , you could also have a game.Attribute with which you track whether music has been started already or not.

    On the menu scene have a rule

    Rule: Attribute game.MusicPlaying = False 
    
             Play Music
    
             game.MusicPlaying = True
    
    end of rule
    

    Well I'll be damned. Thank you for that alternative. Much cleaner than what I have going on with an additional scene. Cheers!

  • MoikMoik Posts: 257Member, PRO
    edited May 2014

    Very nice code. I just implemented it too.
    I made these additions to allow the user to stop the music and not have the menu navigation restart it.


    For the Main Menu actor:

    Rules
    If Attribute game.MusicPlaying = False 
    AND If Attribute game.MusicMuted = False
             Play Music
             Change Attribute game.MusicPlaying = True
    end of rule
    

    For the Options Menu Mute actor:

    Rules
    When Touch is Pressed
             Stop Music
             Change Attribute game.MusicMuted = True
    end of rule
    

    For the Options Menu Play Actor

    Rules
    When Touch is Pressed
             Play Music
             Change Attribute game.MusicMuted = false
             Change Attribute game.MusicPlaying = True
    end of rule
    

    A side-effect of this is that tapping the Play actor re-starts the music. (I'm going to consider that shippable and leave it)

Sign In or Register to comment.