HELP! a little conundrum

TboneTbone Member Posts: 49
edited November -1 in Working with GS (Mac)
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

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Create a global game attribute (integer) called something like squarePosition.

    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
  • TboneTbone Member Posts: 49
    You sir, are a gentleman..

    Thank you, works a treat!

    Tom.
Sign In or Register to comment.