picking objects within a loop

0 favourites
  • 3 posts
From the Asset Store
6 looping tracks to use in your games and projects. These tracks are in the style of the 1960s detective movie genre.
  • If I have a foreach (family)

    I want to pick the closest other member of that same family and put it's values in the current foreach family member...

    How do I pick the closest (or based on whatever) family member and distinguish it within that loop from the current iteration family member when they're both the same family? Within the loop only one is picked... if I say "pick all" will it break that loop?

    What's the best way for family members to pick each other?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • for each family

    set family variable var1 to 1

    call function "check" param1 =self.x, param2= self.y

    set variable var1 to 0(dunno if this will work)

    on function "check"

    family variable var1 does NOT equal 1

    family pick closest to param1, param2

  • Oh I see basically run through twice... and have a flag to see if it's the one from the loop. Problem is you're still in the loop so within that loop only 1 family member can really be picked at a time... but a function frees that up and creates a new set?

    If I have an event that says pick only THIS ONE member of a family...

    then within that a sub-event that calls a function that picks from the same family... the picking starts over again within the function's events...hmmm.

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