Make an actor change image and then change back when touched
BladeBearer
Member Posts: 5
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!
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
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
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
Vote for Nearest Neighbor Scaling option in gamesalad! Let's make our games look truly stunning!
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
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
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.