Why is this "Mute Button" Code not working?

Yeti Ball

  • Posts: 101
Hey All,

Real quick, I've created this code for a mute button in my game.  It's supposed to Mute all the sounds.. the button appears in several difference scenes, and so I've used a Game Attribute to try and control it so that regardless of where it appears it will always show the correct animation and keep the sound Muted.

For some reason it's not working, on one particular scene it seems to "reset" it's self when the scene loads.

If you've got a minute perhaps you could take a look at the code and see if you can't figure out what's wrong.  I've been messing with it for a while, but I'm afraid at this point I will only break it further if I keep tinkering!

Thanks,
YB

Water Drop Game
Check out my new game on the Stencyl Arcade (UPDATED June 21st!).
http://www.stencyl.com/game/play/13158
Don't forget to comment and rate! :D

Innes

  • *
  • Posts: 1961
This may not be the problem, but there appears to be some confusion with the use of your boolean attribute and how that relates to your volume setting...


The If block is saying:


[If Muted
   Set Muted to False
   Set Volume to 0%
]


To me, if Muted is FALSE that means it is NOT muted and we should hear sound, therefore the volume should be high!


The same applies to the otherwise block:


[set Muted to True
   Set Volume to 100%
]


If Muted is TRUE that means it IS muted and we should not hear sound, therefore the volume should be low!
   
Visit www.TheStencylBook.com - the only published book for learning Stencyl.

hansbe

  • Posts: 262
I dont see anything wrong with it. If you do a "load game" or change muted somewhere else, muted could reset. What exactly seems to be the issue?
I might add I would add a 'stop all sounds' / 'play "music"' when i mute/unmute, (in the belief that the music and sounds would still be using resources playing at 0% volume, they probably wont but you never know).
Edit: Actually I see it's possible to pause and resume sounds, which seems even more appropriate for a mute button.

« Last Edit: June 20, 2012, 11:29:00 am by hansbe »

Yeti Ball

  • Posts: 101
I fixed it, thanks guys!

Water Drop Game
Check out my new game on the Stencyl Arcade (UPDATED June 21st!).
http://www.stencyl.com/game/play/13158
Don't forget to comment and rate! :D