Select/deselect problem

networnetwor Member Posts: 89
edited November -1 in Working with GS (Mac)
Hi, I'm trying to make select system (Touch to select, re-touch to deselect)
I know that self.image doesn't work so i use self.color for this example...

Default color is blue
If i touch actor it change self.color to green
If i touch him again i want to change it back to blue...

How can I do this? I tried to make attribute self.selected

1.Rule
If touch is pressed change self.selected to true and change color to green

2.Rule
If touch is pressed and attribute self.selected is true
Then change color to blue and attribute self.selected to false

--> but it doesn't work

Thanks for help.

Comments

  • youngster9youngster9 Member Posts: 326
    make an attribute
    when attribute is true set actor color to blue
    when attribute is false set actor color to green
    when clicked if it is false set it true
    when clicked if it is true set it false

    That should work
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    tshirtbooth's way sure is neat. Another way that would work:

    A boolean attribute called what you like, let's call it toggle

    In the rules of button:

    When touch is pressed
    ---this next rule IN the rule above----
    when toggle = false
    change attributes self.color to green
    change attribute toggle to true
    otherwise
    change attributes self.color to blue
    change attribute toggle to false

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.