Touching actors without triggering the ones below?

beefy_clyrobeefy_clyro Member Posts: 5,394
edited November -1 in Working with GS (Mac)
Hi. I have a problem where i have an actor appear to indicate you have unlocked something, the problem im having is that you need to touch this actor to destroy it. Underneath that actor is other 'touchable' actors, i want the 'unlocked' actor to come to the front (which is does), you touch it to destroy it and you then move on. What is currently happening is that the unlock appears, you touch it but it is also triggering the stuff behind it. I guess i could control all this via attributes but is there an easier solution?
Thanks

Comments

  • AfterBurnettAfterBurnett Member Posts: 3,474
    Would it work with the layers I have recently discovered? Probably not as I haven't even looked into it but I like to spread my worthless 2 cents.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    create a game attribute called game.PopUp

    In the actors that you don't want to be triggered during the popup wrap their touch rules in a rule that says when game.PopUp is false.

    Then in the rule that triggers the pop up window to appear use a change attribute behavior to change game.popup to true. then change it back to false just before destroying the popup.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    like scitunes says, if you have some sort of popup window, you can control it with an attribute like 'popup'. On all the buttons that could possibly be affected when a popup overlays them, add in a check for that boolean...

    However, if it isn't a situation with a popup which you can control, it is either not possible or very difficult to have two overlapping actors with click or tap rules.

    Currently, you need to design your game so that situation does not happen.

    The stacking order of object is called their Z-index. Right now, we don't have access to an actor's Z position - just their X and Y positions.

    If we had access, we could compare the two Z positions of the two actors and do something about it.

    It would also be great to have a boolean attribute in an actor that decided if the Actor was able to be 'clicked-through' or not.
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    thanks guys, i now have this working following your advice. would be great to be able to access the z-index
Sign In or Register to comment.