Actor in the back detects clicks from top actor

Primo.TMPrimo.TM PRO Posts: 35
edited October 2012 in Working with GS (Mac)
Hi, here is my problem:
I have two actors in my scene - the bigger one covers all the screen and is on top, but the actor in the back also detects clicks made in the top actor. How can I avoid this?

Thanks.

Comments

  • Primo.TMPrimo.TM PRO Posts: 35
    Anyone?
  • Primo.TMPrimo.TM PRO Posts: 35
    ?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Remove out the mouse-down rules in the bottom actor.
  • Primo.TMPrimo.TM PRO Posts: 35
    It has only "when touch is pressed" rule.
  • TesseractEngineTesseractEngine Member Posts: 180
    I confess to making this assumption when I was starting out in GS too, but touches and mouse clicks are not 'absorbed' by Actors. They drill right through.

    So it doesn't matter that there is an Actor on top of the other one, it still registers as being touched. Both do.
  • TesseractEngineTesseractEngine Member Posts: 180
    Something to quickly note: it's actually very useful that touches drill through the way that they do.

    If you track when overlapping Actors are being touched with a Boolean (for example), you can track whether one or both are being touched.
  • famekraftsfamekrafts Member, BASIC Posts: 834
    I had similar problem, I created a Boolean, when the top image is displayed, you make the Boolean true. In the bottom button make touch pressed only when the Boolean is false. When the top image moves or destroys or is not overlapping the bottom one, make Boolean false. This way when you press the top button or actor, it will not make the below actor pressed.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Remove the "when touch is pressed" rule from the bottom actor.
  • famekraftsfamekrafts Member, BASIC Posts: 834
    Remove the "when touch is pressed" rule from the bottom actor.
    I believe he wants to make both pressable just not when over lapping.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Remove the "when touch is pressed" rule from the bottom actor.
    I believe he wants to make both pressable just not when over lapping.

    They will always be overlaping. The first posting says the bigger actor covers the whole scene and is on top.
  • famekraftsfamekrafts Member, BASIC Posts: 834
    Yup it maybe a loading screen or instructions or something like that which when pressed will get removed and the bottom actor will get visible. I am guessing because I had exact same problem.
  • Primo.TMPrimo.TM PRO Posts: 35
    Yup it maybe a loading screen or instructions or something like that which when pressed will get removed and the bottom actor will get visible. I am guessing because I had exact same problem.
    Exactly :)
    Thanks anyway, I guess I'll go with the boolean.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    OK -- that little piece of information is helpful.

    The boolean idea works well. Another idea would be spawning the new (bottom) actor when the top actor is removed.
  • famekraftsfamekrafts Member, BASIC Posts: 834
    Yup but in my case it was a play button, it would have looked odd to spawn it later. You will know when you will see my game.
  • RD2012RD2012 Member, PRO Posts: 45
    Great info! Thanks
Sign In or Register to comment.