How do I preserve hierarchy from layout to layout ?

0 favourites
  • 5 posts
  • Id like to use a layout as a repository to design and store all of my complex game items. They are made of an Element sprite with a container filled with Objects sprites also connected to the Element through Hierarchy. Thus Element is parent to Objects.

    When I drag an Element in another layout, I see in the debugger that every Objects are correctly added runtime, put into the right container but everything acts as if hierarchy was broken.

    Am I missing something ?

    Edit :

    I managed to reinstore hierarchy using a test when layout is stored :

    On layout start > for each Element > pick Object where Object.ParentName = Element.Name > add child Object to Element

    It seems to me a bit complicated and I'm sure there's a better way to do this.

    Also, in new layout where just Element is dropped, Objects don't keep their position relative to Element that they have in Repository layout and are all created at Point.0

  • Have you tried the latest beta? They are doing a lot of work on Hierarchy, things like persist and Json are involved.

    yours

    winkr7

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried the latest beta? They are doing a lot of work on Hierarchy, things like persist and Json are involved.

    yours

    winkr7

    Hello,

    Thanks for your answer :)

    Actually I did but I don't see anything changed

  • Do you create an Element instance in runtime? Did you tick "Create hierarchy" checkbox? Also check which properties the child objects are syncing with the parent (on the properties panel).

    I'm using the method you described heavily in my project and it definitely works.

  • Do you create an Element instance in runtime? Did you tick "Create hierarchy" checkbox? Also check which properties the child objects are syncing with the parent (on the properties panel).

    I'm using the method you described heavily in my project and it definitely works.

    Thanks for your tips ! It works now :)

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