toggle menu
Categories
Discussions
Dashboard
Sign In
·
Register
Sign In
·
Register
Categories
Discussions
Dashboard
Sign In
·
Register
×
Home
›
GameSalad 101
›
Working with GS (Mac)
True & False
jstrahan
Member
Posts:
498
April 2010
edited November -1
in
Working with GS (Mac)
can you change between true and false with math in gs using something like (x=0&1)
Comments
firemaplegames
Member
Posts:
3,211
April 2010
Do you mean bitwise operators? I don't believe GS has them.
you can use something similar like modulus:
myCurrentState = (myCurrentState + 1)%2
which will toggle myCurrentState between 0 and 1.
GameSalad does not see 1 and 0 as true and false,
but you can still react to them in a similar way.
jstrahan
Member
Posts:
498
April 2010
ok thanks i was trying to reduce the code as much as possible to turn music on and off i think this will work if i change the variable to an integer instead of a boolean
jstrahan
Member
Posts:
498
April 2010
yep that worked perfect now i got 1 math problem that changes the state of the variable instead of using some rules to switch between true and false
Sign In
or
Register
to comment.
Comments
you can use something similar like modulus:
myCurrentState = (myCurrentState + 1)%2
which will toggle myCurrentState between 0 and 1.
GameSalad does not see 1 and 0 as true and false,
but you can still react to them in a similar way.