How do I Pick 'other' instance while overlapping

Get help using Construct 2

Post » Tue Apr 21, 2015 1:46 pm

Hi,

I have this bit of code:

Image

I want instances of itself to be an 'obstacle' - I need some code where if object a is overlapping object b and also overlapping object b(not self) then do action

This is all in aid of having AI that avoid obstacles and also each other - but I don't want to use Boids.

Any help greatly appreciated as always :)
B
43
S
13
G
8
Posts: 622
Reputation: 7,392

Post » Tue Apr 21, 2015 6:20 pm

I usually handle collisions with other instances of the same object by creating a family with just that object in it and call it "other". Then use events like this:

For each sprite
sprite is overlapping other
for each other
system compare: other.uid !=sprite.uid
--- handle collision

viewtopic.php?f=147&t=119248&p=854897&hilit=push#p854897
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Tue Apr 21, 2015 8:06 pm

thanks @R0J0hound was looking for something similar.. gave me some good ideas!
B
96
S
31
G
15
Posts: 1,180
Reputation: 16,017

Post » Thu Apr 23, 2015 9:01 am

Thank you @R0J0hound - that works :)
B
43
S
13
G
8
Posts: 622
Reputation: 7,392


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Nicolas951, Shenkai the ssj and 21 guests