How do I pick an object that has another object nearby?

Get help using Construct 2

Post » Sat Jun 20, 2015 7:43 pm

I've been scratching my head for a while now and i cant figure out how to do this.

I want to pick every object on screen that has another object within a certain distance. Whenever objects get clumped together i want to change some attributes.

Pick by comparison: distance(block.X,block.Y,Family1.X,Family1.Y) < 120

didnt work at all.


Any ideas?
Follow my progress on Twitter
or in this thread Archer Devlog
B
40
S
17
G
17
Posts: 987
Reputation: 12,646

Post » Sat Jun 20, 2015 8:15 pm

What are you up to? Boids ? Or something else? A picture will help people to understand the case.
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Sat Jun 20, 2015 8:21 pm

Maybe using another object as area of collision?
B
17
S
7
Posts: 280
Reputation: 2,522

Post » Sat Jun 20, 2015 8:46 pm

alextro wrote:What are you up to? Boids ? Or something else? A picture will help people to understand the case.


Im trying to optimize my Z Ordering routine to use less CPU for mobile, so I only want to sort objects that are nearby or overlapping. I don't want to create a lot of dummy sprites to limit the sorting to the ones that are overlapping, so i figured i would use distance instead. So what i need to do is to pick every sprite that is near another sprite, because theres no point to sort sprites that are not overlapping in any way.
Follow my progress on Twitter
or in this thread Archer Devlog
B
40
S
17
G
17
Posts: 987
Reputation: 12,646

Post » Sun Jun 21, 2015 6:41 am

Why not just use the "is overlapping" condition, if that is the only thing you are interested in?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Jun 21, 2015 8:49 am

Because the collision boxes are not set at the outer limits of the sprites, it would be awesome if there was a way to check for any colliding BBbox instead.
Follow my progress on Twitter
or in this thread Archer Devlog
B
40
S
17
G
17
Posts: 987
Reputation: 12,646

Post » Sun Jun 21, 2015 9:35 am

just an idea, have you tried, "for each block" pick by comparison...
ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052


Return to How do I....?

Who is online

Users browsing this forum: Anna Nehves Br, divsyntax, volumetv and 11 guests