A question about picking

This forum is currently in read-only mode.
  • Hello,

    I still seem to get a bit confused about some of Construct's inner workings. Maybe you guys can help me out a bit.

    I have a family "Ships". I want to pick all ships that have their private variable "status" set to "Engaged" and then run several checks and actions on them.

    Does it work like this?

    Pick Ships by comparison: Ships('status') = "Engaged"
      Move to Enemy...
    or do I have to do it like this:
    Pick Ships by comparison: Ships('status') = "Engaged"
      For each Ships
        Move to Enemy...
    Meaning: When I "Pick object by comparison", does it loop through all objects picked automatically within that event, or do I have to do the "For each object" to loop through them?
    And: Does the For each then loop through all the Ships, or just the ones I filtered through picking in the parent event?
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You don't need to use "Pick by comparison" in this case because there is a built-in expression for private variables. Just do like this:

    + Family.Ships: Value 'status' Equal to "Engaged"
        -> Do stuff
    You get that just by selecting the Ships family in the New Condition window and picking "Compare a private variable."  It's even hilighted in yellow.
    And no, there is no need for a loop.  The action will be performed on every member of the Ship family that meets the criteria in the condition.
  • Ah, thanks. That's awesome

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