How do I check if an object in another object ?

Get help using Construct 2

Post » Wed Jul 01, 2015 9:18 pm

Hey guys,

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

Image

Is there way to make it ? I really appreciate any clue. Thank you!
Last edited by bilgekaan on Thu Jul 02, 2015 1:23 pm, edited 1 time in total.
B
77
S
38
G
52
Posts: 504
Reputation: 32,317

Post » Thu Jul 02, 2015 12:10 am

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?
B
45
S
12
G
3
Posts: 1,210
Reputation: 7,559

Post » Thu Jul 02, 2015 12:47 am

You have to Pin objects maybe... Pins is a behaivour.
B
14
S
6
Posts: 63
Reputation: 1,236

Post » Thu Jul 02, 2015 1:43 am

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.
B
77
S
38
G
52
Posts: 504
Reputation: 32,317

Post » Thu Jul 02, 2015 5:53 pm

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.
B
77
S
38
G
52
Posts: 504
Reputation: 32,317

Post » Thu Jul 02, 2015 8:42 pm

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.
B
101
S
39
G
134
Posts: 5,591
Reputation: 85,520


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests