Making an instance Pick it's closest other Self.

0 favourites
  • 5 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • 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

    <img src="http://img10.imageshack.us/img10/6083/uvhs.png" border="0" />

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • cvp

    The problem is the instances pick themselves!

    The closest Instance of Object to Object with IID=1 is Object with IID=1.

  • Then this post could maybe help you.

  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)