You can't change an actor's "visible" attribute, though, so if you're running into trouble trying to do that, instead change attribute self.color.alpha to zero or one.
Make sure you click the 'e' before you input the true or false or other value. I've had trouble with attributes not changing when I just click the textbox and enter the value without clicking the 'e' first.
what im trying to do is a make a sound on and off button, what happens is when touch is pressed and sound is true it changes the image, pauses the sound and changes the Boolean to false(Boolean is set to true in the beginning) then i have another rule with the exact opposite. y isn't it working?
"Make sure you click the 'e' before you input the true or false or other value. I've had trouble with attributes not changing when I just click the textbox and enter the value without clicking the 'e' first." What E?
If you want to make a toggle state button like a sound on off button do this.
Make a interger attribute and call is soundOff have it set to 0
Have a rule when touch is pressed: change attribute to (soundOff+1)%2
then have a rule when attribute soundOff =1 change attribute device sound volume to 0 and change image to sound off button image then open up the otherwise section of that rule and inside there have this: change attribute device sound volume to 1 change image to sound on button image
Yes but your saying you want to make a toggle sound button. You would want to use a interger for that so u can use the modulo function i put above so you dont have to have seperate rules and what not checking the conditions each time and all that. The expression i put above will toggle it back and forth for you
Yeah I am having the same problem with booleans. I dont know how I would change this to true or false, I tried 1 for true and 0 for false. There is no true or false that I found in the "e". I thought these are the best attributes for on/off buttons.
If you want to make a toggle state button like a sound on off button do this.
Make a interger attribute and call is soundOff have it set to 0
Have a rule when touch is pressed: change attribute to (soundOff+1)%2
then have a rule when attribute soundOff =1 change attribute device sound volume to 0 and change image to sound off button image then open up the otherwise section of that rule and inside there have this: change attribute device sound volume to 1 change image to sound on button image
cheers
boom! done! Booleans are sucky, integers do the same but with the added benefits of using math if you need to.
Also, you can get creative with integer switches by using more than 2 states. In many cases, using more than 2 states on a switch can reduce the amount of attributes in your project.
tenrdrmerMember, Sous Chef, Senior Sous-ChefPosts: 9,934
You just type in true or false for booleans no expression editor or anything
Lowercase true or false is all you need for a Boolean.
And yes integers are another good option but keep in mind they use a minuscule amount more ram from what I'm told so loads and loads of them could actually make a difference. But either way is really pretty good.
Comments
Change attribute:
game.yourattriubute to true.
Or, if you wanted to change it to false do this:
game.yourattriubute to false.
Hope this helps
Asymptoteell
What E?
Make a interger attribute and call is soundOff have it set to 0
Have a rule when touch is pressed:
change attribute to (soundOff+1)%2
then have a rule when attribute soundOff =1
change attribute device sound volume to 0
and change image to sound off button image
then open up the otherwise section of that rule and inside there have this:
change attribute device sound volume to 1
change image to sound on button image
cheers
cheers
I dont know how I would change this to true or false, I tried 1 for true and 0 for false. There is no true or false that I found in the "e".
I thought these are the best attributes for on/off buttons.
Lowercase true or false is all you need for a Boolean.
And yes integers are another good option but keep in mind they use a minuscule amount more ram from what I'm told so loads and loads of them could actually make a difference. But either way is really pretty good.
I get this work. I hope it work too for you
@igpxnaruto4
... or: 0 or 1.