Multiple buttons with on/off states but only one on at a time?

JCFordJCFord Member Posts: 785
edited November -1 in Working with GS (Mac)
Whats the best way to approach having multiple buttons each with an on/off state, but being able to only have one on at a time. i.e. If one of the buttons it turned on, all others must then be off?

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Have a global integer attribute called something like "currentSelectedButton"

    Then in each of the buttons have an integer attribute called something like "myButtonID"

    Then, in each button Actor, two Rules, like this:

    Rule
    When Touch is Pressed
    Change Attribute: game.currentSelectedButton To: self.myButtonID

    Rule
    When game.currentSelectedButton = self.myButtonID
    [Change to ON state]
    Otherwise
    [Change to OFF state]
Sign In or Register to comment.