How do I check if an object in another object ?

0 favourites
  • 6 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hey guys,

    I am looking for a way to check if an object inside another object like this :

    Is there way to make it ? I really appreciate any clue. Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Think you need to explain a bit more about what you mean. It a bit hard to understand what you mean with "Object in another object?" Because I don't think you are referring to just overlapping since its the case in both images? or do you mean that the two objects are overlapping a third object and at the same time next to each other?

  • You have to Pin objects maybe... Pins is a behaivour.

  • Thanks for the replies.

    nimos100 I've a X and Y object. The X should be in Y object or Y objects. I mean Y object or objects should cover X object.

  • NVM I've found another way to make my checking. But If there is a solution for this one, you can still answer it may help someone.

  • Two ways come to mind.

    1. Draw x, then y objects. Then check all the pixels to see if any of x is still visible.

    2. Subtract the y shapes from the x shape. It's then covered if the resultant shape has no area.

    Both aren't too easy. The first one could be done using the third party canvas object, but it would be slow to check all the pixels, and you'd want to make the objects have only one color.

    The second idea can get rather complex, but it can be made simpler if you limit the objects to unrotated boxes.

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