How to mute music?

How do I make a button that mutes and un mutes music?

Comments

  • mounted88mounted88 Member Posts: 1,113
    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!!!
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 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

    Cheers
    Aaron
Sign In or Register to comment.