How do I Pick nearest object of instance

0 favourites
  • 4 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 everyone !

    First topic for me!

    I've been looking for few hours now about the following problem, but didn't find anything about it:

    I have an object with some instance of it in my scene. I would like, for each instance, to check the distance between the picked instance (current "loopindex") and the nearest one.

    Unfortunatly, when i use the "Pick nearest" condition, it considers the closest instance as the object himself (-_-') . Which is logic in a way, but absolutely not what I want !

    How can i resolve my problem?

    Thanks guys !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's difficult because I'm not sure where these sprites are in motion or exactly what the setup is...assuming that they are static, I might try having an array that is filled with the UID's of the instances at the start of the layout, then use the a function to select the UID at loopindex (which I believe would be the array.at(x)-1) and pick object by function.param(whichever parameter has this array variable) and pick nearest where + (invert action) UID is equal to function.param. I habit had to try this myself, but this is my first thought about it. You could also just try adding that last bit, with the inverted action to what you have and see if that fixes it?

  • Without using a family. Drag em around.

    https://www.dropbox.com/s/07iesd3m2nfku ... .capx?dl=0

  • Thank you guys ! Both of you! It worked well, but finally what i was trying to do was an awful idea

    I will try something else.

    But thanks.

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