How do I pick a member from a family

0 favourites
  • 6 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hello again.

    Could someone please help me out.

    I have a bunch of different coloured blocks on the screen, each block has the variable "Name".

    So I have ORANGE, BLUE, YELLOW, RED, GREEN.

    Each block is part of the family "Blocks"

    What I need to be able to do is pick out the block "named" say, RED from a bunch of other blocks and move it. How do I go about picking the RED block?

    I've tried:

    SYSTEM>Pick Blocks where Block.Name = "Red" > (Action>) Blocks>Set position (190,150)

    But that resulted in moving ALL the blocks from the family to 190,150!

    Cheers.

  • You'd have to post your code, as the test should pick nothing if the Name is not "Red".

  • is that case sensitive? Although it normally should result in nothing getting picked, if no match is found.

    Did you create the blocks in the same event beforehand? Iirc back in my time when I was more active with Construct, that messed up picking of objects sometimes and I had to put picking stuff in an extra event.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you not just use the UID?

  • You just need to have "Families" of all the colors separtely:

    1) ORANGE

    2) RED

    3) YELLOW

    etc.

    Then, Add all the Red blocks to RED, and so on.

    In Programming Actions: select the family RED.set position(190,150) that way only the red blocks will be moved. You can also specify which red blocks you want among them to move by adding another Condition to it.

    Note: You can then have another Family named "Blocks" with ALL the blocks, if required.

  • It seems to me that your are filtering the family ("Blocks") by doing a pick by evaluate on the objects ("Block"). Your name variable isn't a family variable is it ? If I understand correctly, your condition pick all family instances since at least one "block" has its Name variable set to "RED".

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