How to recognize a "touch is not on any of these x number of actors"?

frankwashburnfrankwashburn Member Posts: 32
edited April 2012 in Working with GS (Mac)
Hi all -
Say I have multiple identical actors in a scene.

How can I get them to react to a touch event that does NOT touch ANY of them? I.e. A rogue touch.

"Touch is outside" doesn't work, because if I touch Actor 1, then that's "touch is inside" for him, but "touch is outside" for any other actors in the scene.

Best Answers

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2012
    Add a game.actorsTouched boolean attribute set to false. On each actor, add a rule When touch is pressed, change game.actorsTouched to true; otherwise change game.actorsTouched to false.

    Then have a separate actor that checks to see if mouse is down AND game.actorsTouched is false, which would be a rogue touch.

    If you need a demo, let me know.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • frankwashburnfrankwashburn Member Posts: 32
    @tatiang Is "mouse is down" the same thing as "touch anywhere on the screen?" if I am testing on an iOS device?
  • frankwashburnfrankwashburn Member Posts: 32
    edited April 2012
    @tatiang, Also, if I have three identical actors, each with the rule "When touch is pressed, set game.actorsTouched = true, otherwise set game.actorsTouched to false"... then if I touch just one of the actors, then in the scene there will be one command setting game.actorsTouched to true and 2 that are simultaneously trying to set game.actorsTouched to false, right? Won't that falsely register as a rogue touch then, if I touch any of the proper actors?
Sign In or Register to comment.