How to touch only one actor at the same time

keekee312keekee312 Member Posts: 91
edited November -1 in Working with GS (Mac)
Hi, I have an issue with the touch.
I have many actors moving everywhere in the stage and I want to click them only one by one but when I touch one, it also selects those which are stuck to it, Is there a way to select only the first one I clicked ?

Thank you

Comments

  • keekee312keekee312 Member Posts: 91
    Thanks for your answer but I don't really know how it can helps me..
  • MotherHooseMotherHoose Member Posts: 2,456
    I put all the actors in an Index variable.
    Then if touch inside -> change pickIndex to # for that actor-> then if pickIndex is that # -> all the action...end with If touch released -> Timer After 0.001 sec -> change pickIndex to 0.

    of course you got to make a Note to list the # for each actor.

    I did this with instances of Actor, as well as several independent actors.

    MH
  • keekee312keekee312 Member Posts: 91
    MotherHoose said:
    I put all the actors in an Index variable.
    Then if touch inside -> change pickIndex to # for that actor-> then if pickIndex is that # -> all the action...end with If touch released -> Timer After 0.001 sec -> change pickIndex to 0.

    of course you got to make a Note to list the # for each actor.

    I did this with instances of Actor, as well as several independent actors.

    MH

    I didn't understand everything.. because If touch is released then the selected actor is not selected anymore, and more, I want to select many actors but not at the same time. I mean I select a blue square then I select a yellow square. But my problem is when I touch a blue square with a red square very next to it, it also selects the red and I don't want that red ^^ (because if you're wrong you lose points). That example is not my game but the logic is the same.

    Thank you
  • MotherHooseMotherHoose Member Posts: 2,456
    do you think you could have a variable for each actor for its selected state? boolean or integer?

    and set that before you set index to 0?

    MH
  • keekee312keekee312 Member Posts: 91
    MotherHoose said:
    do you think you could have a variable for each actor for its selected state? boolean or integer?

    and set that before you set index to 0?

    MH

    I have an attribute self.touched when it's selected.

    But if self.pickIndex = # when it's touched so every actor touched at the same time would be selected at the same time. Something might miss me
  • keekee312keekee312 Member Posts: 91
    no help ?
  • RHRH Member Posts: 1,079
    This should help you:

    http://gamesalad.com/game/play/81660

    If I understood you correctly.
  • keekee312keekee312 Member Posts: 91
    I think it may work :) Thanks. So for each instance actor I have to set an ID. Then in my rules when touch is pressed I change game.WhichId to self.ID (ID of which one is touched)
    and then because an other rule says "when whichID = ID => do what you have to do"
    So only one actor can be selected at the same time. I'll test that and will tell you, Thank you very much !!
  • keekee312keekee312 Member Posts: 91
    Update : something must be wrong cause gamesalad closes up... Hmm I have an idea..
  • keekee312keekee312 Member Posts: 91
    Still doesn't work...
    I manually put an ID for each instance actor and then I set the rules like this :

    When touched is inside => change WhichID to self.ID
    (new rule in the same rule) when self.id = whichID => do what you have to do (become grey meaning that it's selected etc)
    but I still can select 2 actors at the same time...
Sign In or Register to comment.