How do I check if object is next to another object

Get help using Construct 2

Post » Thu Jan 22, 2015 7:34 pm

One way to solve this is by using invisible sprites which overlap, but I'd like a bit more cleaner approach, without using object families and such. Array is also an option, but that would be quite a mess in my situation.

Basically I want a sprite to check if it has a specific object to the right, left, etc. For example platform behaviour can check if its by wall or not, I want to do this to a specific object/sprite.
B
6
S
2
Posts: 24
Reputation: 531

Post » Thu Jan 22, 2015 7:36 pm

Check if distance between objects is below a threshold and then see if the x is > or < than current object?
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Thu Jan 22, 2015 7:59 pm

You can do what Somebody said, or use line of sight too.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Thu Jan 22, 2015 8:12 pm

OK, I admit at this point I am confused.
I have 2 instances of object A, and like 50 instances of object B.
If object A has variable set "active", I want it to check if its next to object B.

I did it your way now, like this:
Object B is checked (applies to all object B-s) if any object A is at given distance(s), if it is then apply animation to object B and change variable on object A.

Nothing happens.
In that, object A is only concluded in expression, does the order chain still apply in that case?
Image
B
6
S
2
Posts: 24
Reputation: 531

Post » Thu Jan 22, 2015 9:57 pm

How about On collision at offset?
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: amazingdream, lordsas, mekonbekon and 66 guests