Making an instance Pick it's closest other Self.

Get help using Construct 2

Post » Thu Aug 08, 2013 12:02 am

Hi,

Reposting this from the General section.

I have now 8 instances of the same object.

How would I make each instance select the one nearest to itself, other than itself?

I used.
For Each Object
-> Pick Nearest to Self.X , Self.Y

But that just picks itself. I tried different methods of not selecting self but none worked.

Basically make the following selections(note my amazing work of art below)

1 selects 2
2 selects 1
3 selects 4
4 selects 3
5 selects 4
6 selects 7
7 selects 8
8 selects 8


Xionor2013-08-08 00:07:06
B
10
S
3
Posts: 233
Reputation: 1,537

Post » Thu Aug 08, 2013 12:07 am

There is a Pick nearest/furthest condition on any object in C2.

you can use that to find the closest object, and then set a instance variable on the object who its partner is.cvp2013-08-08 00:10:57
B
20
S
6
G
4
Posts: 347
Reputation: 4,441

Post » Thu Aug 08, 2013 12:08 am

@cvp

The problem is the instances pick themselves!

The closest Instance of Object to Object with IID=1 is Object with IID=1.
B
10
S
3
Posts: 233
Reputation: 1,537

Post » Thu Aug 08, 2013 12:21 am

Then this post could maybe help you.
B
20
S
6
G
4
Posts: 347
Reputation: 4,441

Post » Thu Aug 08, 2013 12:38 am

@cvp

Ah, thank you! I tried looking for that but didn't find much.

I just threw in a similar solution into my code and the objects stopped picking themselves at least! So it's a step in the right direction.

Going to bed now, so I'll test it further tomorrow if they're also picking the correct ones!Xionor2013-08-08 00:39:20
B
10
S
3
Posts: 233
Reputation: 1,537


Return to How do I....?

Who is online

Users browsing this forum: kototouchdown, Laura_D, lennaert, mikva, ThePakernator and 10 guests