How do I make a single mute button work on all layouts?

0 favourites
  • 7 posts
From the Asset Store
J-BoB Game Button Sound Pack comes with 300 high-quality sound effects
  • Hello all, I was wondering... how do I make a single mute button (with one single global variable) work on all layouts?

    Here's the code: The in Main Menu (first layer) of the game, I have to touch the "instructionsButton" to get to and use the "Sound Off/On" button. Then, I'd like to use the exact same mute buttons ("soundOff/OnButton") in a whole other layout when I hit the "infoButton1" (it's on the Menu/Instructions page, encase the player needs look at the instructions or mute the sound while in playing the level). How do I do that?

    Thanks,

    guannstar (Fnord)

  • Bump:(

  • Please, I really need some help:(

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Create a global variable IsMuted and when it's set on any layout, it sets the global variable... and then all your code to play sounds/music whatever includes the condition IsMuted = false (or 0), then play the audio.

    Nevermind... you're looking for the actual control, not the effect.

    Can't you just create a new copy of the control on the current layout when it's loaded and then copy the settings from the original on or store them globals?

  • So, just create a new global variable for each layer and layout?

  • So, just create a new global variable for each layer and layout?

    Sorry, no...

    Create one global variable. When you create your layout (or load it), create a new copy of the button and set its on/off value to whatever the global variable is. When you change to an existing layout, update the copy of the button there to the same value.

    When it's time to play sounds, you don't check the button, you check the value in the global.

  • Thanks, that helped... I figured it out:)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)