Connecting Objects

For questions about using Classic.

Post » Thu Feb 17, 2011 10:07 am

I'm having issues with connection objects. I'm try to have a event where a value will set to 1 if a block is either on the top, bottom, left, or right side. I can't really get it work.

Here's the cap.
http://www.mediafire.com/?f4gntxrzy8a4f0l
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Thu Feb 17, 2011 11:31 am

This looks fishy to me :
[code:2kwxxfup]
+ Block_Green: Y Equal to Block_Green.Y[/code:2kwxxfup]

When i remove it it says : connected 60, not connected 2.
Maybe these 2 not connected are the ones on the left and right of the chain?
It's lunch time, i'll investigate a bit :)
B
4
S
1
G
2
Posts: 91
Reputation: 1,057

Post » Thu Feb 17, 2011 6:04 pm

Overlaps at offset would work good in this situation.

[code:15jad7z4]+ System: For each Block_Green
+ Block_Green: overlaps Green : offset (1,0)
+ System: OR
+ Block_Green: overlaps Green : offset (-1,0)
+ System: OR
+ Block_Green: overlaps Green : offset (0,1)
+ System: OR
+ Block_Green: overlaps Green : offset (0,-1)
-> Block_Green: Set 'Connected' to 1
[/code:15jad7z4]
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Thu Feb 17, 2011 8:39 pm

Okay, I'll try it.

My boxes or 48 by 48, so, wouldn't be 49 and -49 instead of one?
[code:340uggyb]
+ System: For each Block_Green
+ Block_Green: overlaps Green : offset (49,0)
+ System: OR
+ Block_Green: overlaps Green : offset (-49,0)
+ System: OR
+ Block_Green: overlaps Green : offset (0,1)
+ System: OR
+ Block_Green: overlaps Green : offset (0,-1)
-> Block_Green: Set 'Connected' to 1
[/code:340uggyb]
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Thu Feb 17, 2011 10:02 pm

Use 1 if you want objects touching to be marked as connected. With 49 objects with a 48 pixel gap between them will be marked as connected.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Thu Feb 17, 2011 10:37 pm

Ah, so it offsets the collision boxes?
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Thu Feb 17, 2011 10:40 pm

yep.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests