Make an actor change image and then change back when touched

I am trying to create a mute button, it would require the same for a pause button and it must be quite simple but I just can't do it.
I need the sound image to change to a mute button and the music to stop (simple enough) but how do I make it change back to the original image and for it to play music again?

Thanks!

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • BladeBearerBladeBearer Member Posts: 5
    Ok thanks, although I don't have the "music" option to select like he does.
  • rich3626rich3626 Member, PRO Posts: 1

    Video doesn't work!!

  • owen_dennisowen_dennis Just a guy, you know. Member, PRO Posts: 236
    edited February 2016

    @rich3626 said:
    Video doesn't work!!

    I usually do a rule within a rule and a single self attribute. This is good for any button that's a simple toggle switch:

    Rule 1
    If touched = pressed

    -Rule 2
    -If self.pause = true
    --change image to pause
    --(pause music or whatever other actions you need it to do here)
    --change self.pause to false
    -otherwise
    --change image to play
    --(unpause music or whatever other actions you need it to do here)
    --change self.pause to true

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    You can use a simple expression

    Make a self attribute integer On/Off
    Rule

    When touch is pressed

    Change attribute self.On/Off to 1-Self.On/Off (this will switch between 1-0 during each press)

    Rule

    When self.On/Off = 0

    Play music

    Rule

    When self.On/Off = 1

    Pause music

  • GnarlyGnarly canadaMember Posts: 840

    If same button is sound on and sound off?

    I make game integer attribute. Set to 1 call it "sound"

    When button touched Change attribute sound to sound *-1

    Rule. If sound is >0 play music.
    Change image to image. Music on

    Rule if sound<0 then
    Change image no music image

    No matter how many times you pressed button it will work.

Sign In or Register to comment.