How do I pin objects from two families?

0 favourites
  • 3 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hi everyone, I need your help.

    I have two families (example: nations and cities), is it possible to pin all the objects of the "city" family to the objects of the nations family? respecting the insertion order?

    sorry for my bad english

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Matte78

    It depends on how these objects are created and at what moment do you need to pin them.

    Do you put them on the layout in editor? Or are they created in runtime?

    If you have instance variables on both Nations and Cities families that cal help to link them together (say, Nations.Name="France" and Cities.NationName="France") then it's easy:

    Nations Compare instance variable Name=Cities.NationName -> Cities pin to Nations

    If the only way to identify each pair is their order of creation, you can do something like this:

    System-> For x=0 to Cities.count-1
       System -> Pick Nth instance of Cities instance=loopindex
          System -> Pick Nth instance of Nations instance=loopindex   :   Cities Pin to Nations
    [/code:e31akpof]
  • I have no instance variables, so the second method you wrote is perfect.

    thank you very much, I thought it was a simple thing, but I could not find the solution

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