Sound switch on / off.
cucurbit
Member Posts: 68
Hi!
I've got a problem with my game - so, I've got a settings menu with slider, so you can adjust the sound volume in the game.
I've got also the sound on / off in the pause menu and I want the player to could easily mute the sound in the game and if he want to bring it back it will come back to the settings value and here is what I do:
If touch is released and music volume > 0
Change att music.volume (the one I've made for the slider purposes, it is connected to game.audio.music.volume in the devices section) to self.savemusic (real attribute in the actor).
If touch is released and music volume = 0
change att. self.savemusic to att music.volume
It does not work, it is muted all the time.
Any ideas how to change it?
I've got a problem with my game - so, I've got a settings menu with slider, so you can adjust the sound volume in the game.
I've got also the sound on / off in the pause menu and I want the player to could easily mute the sound in the game and if he want to bring it back it will come back to the settings value and here is what I do:
If touch is released and music volume > 0
Change att music.volume (the one I've made for the slider purposes, it is connected to game.audio.music.volume in the devices section) to self.savemusic (real attribute in the actor).
If touch is released and music volume = 0
change att. self.savemusic to att music.volume
It does not work, it is muted all the time.
Any ideas how to change it?
Comments
This post about a similar issue might help:
http://forums.gamesalad.com/discussion/56573/making-a-boolean-switch
When touch is pressed change game.Music to (game.Music+1)%2....every time you touch it will change it from 0-1-0-1-0
When its 0 set the volume to your slider when its 1 mute the sound.
It might be best when the player touches the slider (they obviously want to change the volume) to change it back to 0.
Darren.
Thank you so much!
Or you could avoid the modulus and use:
1-Game.Music