Create a Game attribute (Boolean) Name it what you want. For this it's called on/off
In your sound button actor make a rule
(When touch is pressed)
Change attribute Game.on/off to (game.on/off+1)%2 Change attribute Game.music to 1 Change attribute Game.sound to 1 Change attribute Self.image to (sound on image name) Otherwise Change attribute Game.music to 0 Change attribute Game.sound to 0 Change attribute Self.image to (sound off image name)
Pretty simple once you get it set up, you need to images, one for sound on and the other for sound off. You can also change image to switch between images, I just always use change attribute to switch the image but it's up to you.
Create a Game attribute (Boolean) Name it what you want. For this it's called on/off
In your sound button actor make a rule
(When touch is pressed)
Change attribute Game.on/off to (game.on/off+1)%2 Change attribute Game.music to 1 Change attribute Game.sound to 1 Change attribute Self.image to (sound on image name) Otherwise Change attribute Game.music to 0 Change attribute Game.sound to 0 Change attribute Self.image to (sound off image name)
Pretty simple once you get it set up, you need to images, one for sound on and the other for sound off. You can also change image to switch between images, I just always use change attribute to switch the image but it's up to you.
Thanks a lot this really helped!!!
tenrdrmerMember, Sous Chef, Senior Sous-ChefPosts: 9,934
FYI you don't need to mute the sound attribute if you only want to shut off the music.
The music attribute is for platt music behaviors and the sound attribute is the master volume for the play sound behaviors.
Hence you can shut off music and not sound effects or visa versa
Comments
Name it what you want. For this it's called on/off
In your sound button actor make a rule
(When touch is pressed)
Change attribute
Game.on/off to (game.on/off+1)%2
Change attribute
Game.music to 1
Change attribute
Game.sound to 1
Change attribute
Self.image to (sound on image name)
Otherwise
Change attribute
Game.music to 0
Change attribute
Game.sound to 0
Change attribute
Self.image to (sound off image name)
Pretty simple once you get it set up, you need to images, one for sound on and the other for sound off. You can also change image to switch between images, I just always use change attribute to switch the image but it's up to you.
The music attribute is for platt music behaviors and the sound attribute is the master volume for the play sound behaviors.
Hence you can shut off music and not sound effects or visa versa
Cheers
Aaron