Jump to content

Propagation/Disabling clicks on objects underneath others


Ninjadoodle
 Share

Recommended Posts

Hi guys

 

Just wondering whether there is a way to disable clickable objects, when another clickable object is on top.

 

Example - I have a red ufo and a blue ufo (both clickable), When the red ufo moves behind the blue ufo, I only want blue ufo to take action (if clicked), because it is in front.

 

Thank you in advance for any help :)

Link to comment
Share on other sites

PandaJS relies on the PIXI JS interaction manager which doesn't provide the functionality you're looking for. It simply loops through all objects that could have been hit and calls the click event on them. I suggest you raise this question on the PIXI forums, or submit a PR for PIXI with a fix for it. Also worth checking if the PIXI dev branch has had any work done on this feature.

Link to comment
Share on other sites

@Ninjadoodle, it should work just as you described. I just tried with two interactive sprites, and only the front one gets it's click function called (if i click on point where they are overlapping).

 

There might be something wrong with your code, can you show some?

Link to comment
Share on other sites

Hi Guys

 

Thank you for your help :)

 

@enpu - I've been trying to make a 50% fade overlay with a menu popup. I thought that the '50% fade overlay' should be blocking clicks for the buttons underneath, as it is 'interactive'.

 

After playing around, I've realised that if I give the '50% fade overlay' and empty function (I don't want it to do anything, just block clicks), then it does just that.

 

Is this the correct approach to this situation?

 

Thank you again for your help!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...