How do I avoid clicking on underneath object

0 favourites
  • 8 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • There is one thing that always gets me confused.

    why can I click on a object even though is underneath another one?

    I might be missing something here but it should be very simple.

    Here is the capx file.

  • You could Just add is visible to the condition or set variable when you want it enabled.

  • I don't understand your answer. Here is my question again:

    How come I can click on the blue image if it is underneath the green one?

    Since the blue is on top, if I try to click on the green over the blue it shouldn't work.

    It feels like the click go though all the objects and trigger any action associated with all of them

  • CD2 doesn't care about who's on top. You need to apply more logic to isolate this case yourself.

  • I know how to do it using IF but I don't think it should be like that at all.

    I doesn't make any sense. The object on top should block the click on the object in the bottom.

    Even if I need to change a object's property would make more sense than it is now.

  • The more flexible the system the more logic you need to get specific results.

    I updated your capx


    There are so many ways to validate the click, some easy some hard. This is just one example that takes into account the relative position and zindex of the green sprite. I usually use variables to enable what i want clickable. But based on your example i chose to do this.


    In any case that's just the nature of programming. sometimes you have to do the heavy lifting.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • troublesum

    Thank for it!

    I know how to do it, I just don't think it makes sense we need to do it like that for such a simple thing.

  • It does and it doesn't make sense at the same time , it all depends on how you see things.

    Other would like to hit it for his own reason , some other again , would like not to hit it , since its under something else , and logic (human logic) says not to.

    Other than that , thats why it has the visible command , or destroy etc , in order to please both situation.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)