How do I pick all members of a family to do an action?

0 favourites
  • 5 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Hello!

    I have a family called Animals with several instances on same screen.

    This family has a instance variable, let's call it "var1".

    And, finally, I have an sprite called dummy with several instances on same screen.

    I want to every tick set var1 of each instance of family Animals to:

    distance(Animals.X,Animals.Y,dummy.X,dummy.Y), picking the dummy that is nearest to Animals.

    When I have one single instance of Animals, it works. More than one, the var1 get non sense values.

    I don't know how to pick all members of Animals to get this action right.

    Could you help me?

    Thanks!

    Tagged:

  • So you also have a pick nearest dummy condition I guess? I think system for each 'Animals' then pick nearest dummy to Animals on the conditions should work.

  • Hi! Thanks for replying!

    Yes, as I said, I've picked nearest dummy.

    I tried to to use system for each Animals already. It doenst work.

    One instance set the var1 correctly, the others get a static value.

    But, could you analyse my event? Is there anything wrong?

  • The addition of the every 0.1 seconds will affect it just remove that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It worked!

    Thanks a lot!

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