How do I pick the X nearest intances of an objets

Get help using Construct 2

Post » Sun Mar 15, 2015 5:46 pm

Hello,

Is there an easy way to pick a number of nearest instances of an object ?

Ex : pick the 3 nearest, and order them by distance.

Thanks
B
6
S
1
Posts: 45
Reputation: 509

Post » Sun Mar 15, 2015 6:01 pm

for each playerb sort by distance(playera.X,playera.Y,playerb.X,playerb.Y) < 250 ascending
action
loops through the objects closer then 250 pixels starting with closest.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Sun Mar 15, 2015 9:02 pm

Thanks, it works perfectly :)
B
6
S
1
Posts: 45
Reputation: 509


Return to How do I....?

Who is online

Users browsing this forum: plinkie and 20 guests