pick nearest always picks first instance

0 favourites
  • 2 posts
From the Asset Store
This Girls Game allows young fashionistas to develop their taste and skills as a fashion designer.
  • hi,

    i dispair.... either i'm stupid or construct handle loops very strange.

    i just want to replace e.g 5 sprites with a different one but only when the distance between the sprites > 100

    the event "pick nearest" always pick the first instance and not the nearest.

    the action "set txt to" on line 32 always display the x from the first instance.

    line 31, works fine. every run of the loop it picks a different instance

    any idea?

    thx!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When you spawn a stone inside the loop then you can't pick it until that event finishes. (You can pick a newly created object by UID only). Those new stones you spawn won't be picked by the 'Pick all' condition.

    I'm guessing you have one stone on the layout at the start and you call this function to create more but it's only able to pick that first stone. You'll have to try a different approach.

    For example, you could spawn all the stones first, in a different event. Create all stones at (-1000, -1000) with boolean flag placed = false. Then you can have your loop that would be almost the same but instead of spawning stones it moves one of the unplaced stones to the correct position.

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