HELP! a little conundrum
Tbone
Member Posts: 49
I have a little problem that I cant seem to figure out.
I have three squares in a row. Lets say they are red, blue ,green. When a button is pressed I want to cycle through the positions ie
RED / BLUE / GREEN
button press, changes to:
GREEN / RED / BLUE
button press changes to:
BLUE / GREEN / RED
then back to start.
Can anybody point me in the right direction as to how I would accomplish this?
Regards,
tom
I have three squares in a row. Lets say they are red, blue ,green. When a button is pressed I want to cycle through the positions ie
RED / BLUE / GREEN
button press, changes to:
GREEN / RED / BLUE
button press changes to:
BLUE / GREEN / RED
then back to start.
Can anybody point me in the right direction as to how I would accomplish this?
Regards,
tom
Comments
In your button actor, create a Rule:
Rule
When Touch is Pressed
Change Attribute: game.squarePosition To: (game.squarePosition+1)%3
This will cycle game.position through 0,1,2
Then, in each of your square Actors, create Rules like this:
Rule
When game. squarePosition = 0
Change Attribute: self.PositionX to whatever
Rule
When game. squarePosition = 1
Change Attribute: self.PositionX to whatever
Rule
When game. squarePosition = 2
Change Attribute: self.PositionX to whatever
You'll need to put those Rules in each one.
Hope this helps!
Joe
Thank you, works a treat!
Tom.