How do I fix the sound?

Get help using Construct 2

Post » Wed Mar 15, 2017 8:12 pm

I have 2 layouts
When the first layout strated then the music start automatic.
If I touch the mute gomb then the music muted and set muted to 1
something else set muted to 0 this is works fine, but only on one layout.
If I go to second layout and come back to first layout then start the music automatic and now play together the 2 track, it is very annoying.
So how can I set up when I go to the second layout from the first layout and come back from the second layout for the first layout then do not start the music again and do not play together the two track, only just the one track play. And if I stop the music on the first layout and go to second layout then do not play the music.

Thank you!
B
20
S
10
G
10
Posts: 143
Reputation: 7,096

Post » Wed Mar 15, 2017 8:42 pm

You can use a global variable to determine which music is played and global variables work in all layouts.

So you need a global variable and call it MusicControl

Then when you go to layout 2 and want a certain music stopped in the event where you go back to layout one set MusicControl=1.

Now in layout 1 you use that variable to tell which music you want played or for no music.

On MusicControl =1: Stop all Sounds
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,825

Post » Wed Mar 15, 2017 8:51 pm

Hi!
Thank you for your info.
I do not understend all what you wrote yan you write me the commands.
Currently it looks like this:
Layout 1.
When start the layout then the music automatic play
When touched pause button then Set 1 Muted Variable =stop all music
Someone else Set 0 and play music
Layout 2.
When touched the back buton go back to Layout 1 and start the music and now play 2 track together.

So if I create a global variables and connect the layout 1 and layout 2 then how need to be looks like?
Who can I reach with this when the app started then the music will automatic play?
An I want to if the user like the music then can listen on layout 1 and on layout 2 so the music only stop if the user want to touch the mute button.
B
20
S
10
G
10
Posts: 143
Reputation: 7,096

Post » Wed Mar 15, 2017 10:11 pm

You will need to take the music out of the ON Start Of Layout or it will always start playing when you return to layout 1

Global Variable MusicControl = 0


On MusicControl = 0: Play Music

On MusicCntrol= = 1: Mute Music

On Pause Button Pressed: Set MusicControl = 1

On Play Button Pressed: Set MusicControl = 0

That will allow you to control the music when you go back and forth between layouts using just one variable.
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,825

Post » Thu Mar 16, 2017 2:35 am

Thx I solved meanwhile.
I created a layout 3 which is the same as layout 1 expect here do not start the music when started the layout :D
B
20
S
10
G
10
Posts: 143
Reputation: 7,096


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 28 guests