Help With Toggle
Wllew4Games
Member Posts: 34
in Tech Support
I need to know how to make it so when I touch an actor, it changes an attribute from 0 to 1 or from 1 to 0
Please Help!
Comments
create a boolean attribute... call it whatever you want... for arguments sake we'll call it ButtonToggle
On your button actor have the following rule:
When ALL conditions are valid:
Actor receives event Touch is pressed
When ButtonToggle is False
Change Attribute ButtonToggle to True
Then set up whatever it triggers to activate when ButtonToggle is True.
To use the same button to switch the trigger off add the following to your button actor:
When ALL conditions are valid:
Actor receives event Touch is pressed
When ButtonToggle is True
Change Attribute ButtonToggle to False
The First toggle worked fine, but when I tried to toggle it back, it stayed the same
The change attribute didn't work.
Here is a file with four different examples of how to do it. (There are probably several more.)
I FIGURED IT OUT!!!!
so happy btw
This is by far the best and shortest toggle in my opinion:
Change Attribute: game.toggle = 1 - game.toggle.
game.toggle (or whatever you want to call it) needs to be an index or integer.
Like Kevin said much simpler way is . . .
When Touch is pressed
--Change A to 1-A
It used to work with what I said before but game salad updated and now I can't seem to get it to work.