"For Each" Family, or just Family?

  • I'm aware the "For Each" tutorial by Arima (a great help!) and I've reviewed a few tutorials and the manual for "Families".

    I'm not sure if this goes in the "How Do I...?" forum, for it's not quite a request on how to do something. I just need info and clarification.

    I'm wondering if someone can give me a run-down on when I ought to use "For Each" with Families. It's my understanding that Families has a kind of For Each build into it. But that doesn't seem to be the case in certain instances.

    The "behind the scenes" inner-workings of "For Each" and Families is something I don't know a lot about, so it's hard to see when I need to add "For Each" as part of the event conditions and when I can let a Families condition stand on its own.

    Thanks, everyone!

  • Don't think of everything in a family as different objects, think of them as instances.

    That means you only use for each when you need to forcibly pick the object, just like you do with instances.

  • newt - Thanks for the reminder about Families. :) I do recall that point. I guess I need to review it some more. LOL

  • You seem a little confused, since families aren't special in any way with regards to 'for each'. They work exactly the same as everything else.

    It's conditions themselves that have a built-in for-each. See How Events Work. Lots of people make the mistake of using for-each where it is not necessary, since conditions usually check every instance anyway - try not to fall in to that trap.

  • Ashley - Right. I do remember that, too, and I've been using For Each sparingly since I came across more information. But I'm still struggling to grasp WHEN For Each is necessary.

  • As Ashley mentioned, families are treated the same way as other objects, so the for each tutorial should work fine for this if you read it and imagine I'm referring to a family rather than a sprite.

  • Arima - Thanks for the clarification. If it's that simple, I think I can manage. May I call on you for help if I hit a snag?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm pretty busy but if it's not too much then sure.

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