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.
Image
B
63
S
28
G
39
Posts: 459
Reputation: 24,183

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
44
S
11
G
2
Posts: 1,182
Reputation: 6,838

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.
Image
B
63
S
28
G
39
Posts: 459
Reputation: 24,183

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.
Image
B
63
S
28
G
39
Posts: 459
Reputation: 24,183

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
92
S
32
G
106
Posts: 5,272
Reputation: 69,455


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, plinkie, rayolf and 10 guests