How do I make a mute button work!

Get help using Construct 2

Post » Fri Jun 13, 2014 10:44 pm

I'm trying to make a mute button. It's currently based on a sprite with 2 animation frames, and is using a boolean to detect states (although I've tried with an integer & a compare frame with no success).

On touch I was trying to get it to test state, switch animation frame & mute the sound. It works when theres only one touch statement pertaining to the 'mute' object in the events panel but not when theres 2. Where am I going wrong? Would it be easier to simply move the 'mute' object off stage and simply replace it with an unmute button? I'm presuming the system is fussing about 2 touch statements on one object...

Image
B
7
S
1
Posts: 27
Reputation: 511

Post » Fri Jun 13, 2014 10:49 pm

Why don't you use On Touched Object.

Is Touching will fire every tick as the name applies.

IS TOUCHING. Am I current touching.

Where as On Touched. Implied do something when the Touch first happens.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,038

Post » Fri Jun 13, 2014 10:50 pm

Good advice, I'll give a try an check the rest of the project as well.
B
7
S
1
Posts: 27
Reputation: 511

Post » Fri Jun 13, 2014 10:55 pm

Nup, didn't work. I also tried it as shown below. I'm thinking the editor doesn't like more than one touch test being assigned to a single object. Can anyone confirm?

Image
B
7
S
1
Posts: 27
Reputation: 511

Post » Fri Jun 13, 2014 11:17 pm

Even this with 2 seperate objects doesn't work! Nothing happens when I click, but if I disable the unmute touch event then the mute touch event works perfectly!

I'm confused.

Image
B
7
S
1
Posts: 27
Reputation: 511

Post » Fri Jun 13, 2014 11:36 pm

Ahah I got it. There was a lot of useful info in this post.

https://www.scirra.com/forum/viewtopic.php?f=147&t=94232&p=787842&hilit=mute#p787842

Here's my event, I've reverted back to a single button with 2 frames of animation - works perfectly. Not tested it on mobile yet though.

Image
B
7
S
1
Posts: 27
Reputation: 511

Post » Sat Jun 14, 2014 5:12 am

This is how I got the mute button to work.

mute.jpg

The wait for 0 seconds is the key.
You do not have the required permissions to view the files attached to this post.
B
21
S
3
Posts: 67
Reputation: 1,099

Post » Tue Jun 17, 2014 2:08 pm

Cheers dude, I'll try that out - My version doesn't work when I export to mobile, the music isn't muted.
B
7
S
1
Posts: 27
Reputation: 511

Post » Tue Jun 17, 2014 4:16 pm

ForgedByHand wrote:Cheers dude, I'll try that out - My version doesn't work when I export to mobile, the music isn't muted.

Follow this tutorial
It works for me when exported to cocoon js

viewtopic.php?f=147&t=105920&p=792507#p792507
B
8
S
2
Posts: 203
Reputation: 1,169


Return to How do I....?

Who is online

Users browsing this forum: Lancifer and 30 guests