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

Get help using Construct 2

Post » Thu May 22, 2014 4:31 pm

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?
Image
Image
Image
Image
Image

Thanks,
guannstar (Fnord)
B
36
S
9
G
1
Posts: 629
Reputation: 3,956

Post » Thu May 22, 2014 5:00 pm

Bump:(
B
36
S
9
G
1
Posts: 629
Reputation: 3,956

Post » Thu May 22, 2014 7:05 pm

Please, I really need some help:(
B
36
S
9
G
1
Posts: 629
Reputation: 3,956

Post » Thu May 22, 2014 7:15 pm

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?
B
22
S
4
G
1
Posts: 100
Reputation: 2,150

Post » Thu May 22, 2014 7:53 pm

So, just create a new global variable for each layer and layout?
B
36
S
9
G
1
Posts: 629
Reputation: 3,956

Post » Thu May 22, 2014 11:05 pm

guannstar wrote: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.
B
22
S
4
G
1
Posts: 100
Reputation: 2,150

Post » Tue May 27, 2014 3:24 am

Thanks, that helped... I figured it out:)
B
36
S
9
G
1
Posts: 629
Reputation: 3,956


Return to How do I....?

Who is online

Users browsing this forum: facecrime, zenox98 and 7 guests