# Why isn't overlapping at offset working correctly?

Discussion and feedback on Construct 2

### » Mon Feb 22, 2016 2:06 am

I'm using where a "house" overlaps with a "road" to determine a houses variable but for whatever reason it doesn't work properly in the game but in a simpler test version it does, can anyone explain what I am doing wrong?

https://www.dropbox.com/home?preview=Test.capx
B
27
S
12
Posts: 222
Reputation: 2,624

### » Mon Feb 22, 2016 2:51 am

These require login. You should be able to make these public.
B
71
S
22
G
281
Posts: 3,842
Reputation: 154,886

### » Mon Feb 22, 2016 8:30 pm

I looked at the sharing options, it says anyone with the link can view it
B
27
S
12
Posts: 222
Reputation: 2,624

### » Mon Feb 22, 2016 8:38 pm

B
27
S
12
Posts: 222
Reputation: 2,624

### » Mon Feb 22, 2016 8:51 pm

Road - yes, Test - no.
B
71
S
22
G
281
Posts: 3,842
Reputation: 154,886

### » Mon Feb 22, 2016 9:05 pm

Ok well still, can you tell me what's wrong with the road? I managed to get it to work with the test but for some reason it doesn't work with the road program
B
27
S
12
Posts: 222
Reputation: 2,624

### » Mon Feb 22, 2016 9:17 pm

What exactly are you expecting to happen?
B
71
S
22
G
281
Posts: 3,842
Reputation: 154,886

### » Mon Feb 22, 2016 9:22 pm

Well depending on whether the road is to the left, right, above or below the houses, the houses connection variable should become a 1,2,3, or 4 and then it will spawn a car on the side that the road is on but for whatever the connection variable doesn't change the way it should
B
27
S
12
Posts: 222
Reputation: 2,624

### » Mon Feb 22, 2016 9:56 pm

There's several problems.
1) your house bounds are too large, so they can overlap in multiple directions, but you need to enforce only one direction. Make the bounds smaller.
2) in event 10 you are double checking House overlapping Roads, but in 22+ you are checking Roads overlapping Houses, which is not the same thing, and 22 and 23 both offset -105, which is wrong.

Fix those up and it works better.
B
71
S
22
G
281
Posts: 3,842
Reputation: 154,886

### » Mon Feb 22, 2016 10:06 pm

actually at 22 and 23 it's checking (-105,0) and (0,-105) so that's fine. I fixed the other stuff you said and it works better but for some reason the order of the code (22-25) still affects what the connection variable will be for the houses
B
27
S
12
Posts: 222
Reputation: 2,624

Next