So Confused, but not giving up
Ok the more I work with GameSalad, the more I start to understand it. At times I can visualize what I want to put in the code but cant actually do it. Haha
So I have a Player (actor) that starts off with the color set to white. I want to change that color to black when a button is pressed. Then if its pressed again change it back to white. So kind of a back and forth code.
Am I heading down the right path with what i have in my mind.
A game attribute boolean (check color) to check players color.
A game attribute integer (switch) set at 0, to check if the button is pressed.
Under the switch actor:
rule - when pressed - change attribute game.switch to 1
Under the player actor:
Rule
when game.switch = 1
when check color is true
change attribute to alpha 0
otherwise
change attribute to alpha 1
Comments
There are many ways that you can do things in Gamesalad, but one way that I like to make "switches" or "back and forth" actions work is to do the following:
(game.changeColor)
game.changeColor
to(game.changeColor + 1)%2
game.changeColor
= 1 -> changeself.alpha
to 1 whengame.changeColor
= 0 -> changeself.alpha
to 0(game.changeColor + 1)%2
saves you from writing more code than necessary, but don't forget the ()www.mbstudios.co | Free Stuff
From Scratch
Changing the Alpha to 0 will make actor invisible, to change back and forth from white to black try this. replace the touch rule with attribute.
Learned this from @Socks
Thank you everyone.
Matt that did work better and yes BBEnk I meant the RGB not alpha, thanks for catching that mistake.
@GamingtilDawn Glad we could help!
www.mbstudios.co | Free Stuff