Help with Button-What did I do wrong?
This is what I have set up for my sound effects button (it's not working):
When touch is pressed and attribute self.soundon=true:
change attribute self.soundon to false, and change image.
When touch is pressed and attribute self.soundon=false:
change attribute self.soundon to true, and change image.
When attrebute self.soundon=true:
change attrebute game.audio.sound to 1
When attrebute self.soundon=false:
change attrebute game.audio.sound to 0
The image isn't changing, and neither is the attribute! What did I do wrong?
When touch is pressed and attribute self.soundon=true:
change attribute self.soundon to false, and change image.
When touch is pressed and attribute self.soundon=false:
change attribute self.soundon to true, and change image.
When attrebute self.soundon=true:
change attrebute game.audio.sound to 1
When attrebute self.soundon=false:
change attrebute game.audio.sound to 0
The image isn't changing, and neither is the attribute! What did I do wrong?
Comments
Hi @ds1239 it's best to have this toggle with a Rule and its Otherwise section:
Rule: When touched is pressed
Rule: ---nested in the above--- When self.soundon is true
Change Attribute self.soundon to false
Change Image
Otherwise
Change Attribute self.soundon to true
Change Image
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Oh, I see, I thought it was for the user to toggle sound on and off...
So in this case, just put Change Attribute self.soundon to true in an actor at the outside of your scenes play area; and in your pause button, just a Change Attribute self.soundon to false. I think that should work for you.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
OK, if it's to toggle the sound, then you don't need a custom attribute, you can just toggle the sound volume....
But to check first, with your pause game, I assume you've got a button on each scene with a Pause Game behaviour in it's Rules?
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps