How do I compare all Picks at once?

Get help using Construct 2

Post » Thu Sep 25, 2014 6:01 am

I want to take a subset of instances and get the min distance to an object.

so...

Pick all Sprite1 AND Sprite1.isEnabled = true

so let's say I have 20 Sprite1s and this line above picks 10 of them

now I want to find which of those 10 Sprite1s is closest to a particular x/y (let's say Home).

Pick Sprite1 where min(distance(Sprite1(0).x, Sprite1(0).y, Home.x, Home.y),distance(Sprite1(1).x, Sprite1(1).y, Home.x, Home.y), etc..

the problem here is I am referencing each instance directly and not filtering the instances that are Enabled=false

how do I apply the min expression to a subset of instances??

Thanks...
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Thu Sep 25, 2014 6:51 am

You can use [condition: pick nearest] after the first pick condition though.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Thu Sep 25, 2014 2:17 pm

aha! thank you thank you!

I've seen pick nearest before, but wasn't sure where to find it. It's not a System expression, it's in the object condition...

wow, this makes things SIMPLE!

@DuckfaceNinja thanks again!
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715


Return to How do I....?

Who is online

Users browsing this forum: Blendi1223, ditocruz, kellehk and 22 guests