How do I Z Order Sort Effectively?

  • I am thinking through the process of changing over my Z order sorting to using the new(er) event and thought I would think out-loud (here, in this post) in case anyone has any tips, as I haven't dealt with Z order much.

    I'm also a little confused on dealing with this:

    [quote:3d825f7p]then inserts the sorted sequence back in to the holes left behind.

    This means if I have two separate families I can't really sort them separately using this? As it sounds like if the z order was ABAB it would never get changed to lets say AABB—it would always stay ABAB as the instances in the family are only changed with themselves. It would be nice to have separate families and not have to lump everything into one family.

    My projection goes left when (perspective) farther away so was thinking assigning the variable based on distance from the top right. Maybe have a modifier variable that I set manually, so family instance variable = distance(top of project, right of project, instance.x, instance.y) + zModifier

    Then when player and NPCs moving would it make sense, to save processing power, to use the move next to action instead of constantly resorting everything? Because if only one object is moving it seems to make sense to only move that objects z order instead of resorting everything

  • Having an extra family has no drawbacks.

    Don't think of it as families in a family. It's merely a family of objects grouped together for z sorting.

    I would suggest just making a family variable that uses the y value, and sorting by that to start.

  • Having an extra family has no drawbacks.

    Don't think of it as families in a family. It's merely a family of objects grouped together for z sorting.

    I would suggest just making a family variable that uses the y value, and sorting by that to start.

    Ah, I never really realized that—you can add one object to many different families? For some reason I was under the impression that it could just belong to one family.

  • what newt said or use IID sorting

  • what newt said or use IID sorting

    How would you sort by IID?

  • > what newt said or use IID sorting

    >

    How would you sort by IID?

    same as you sort them by z-order just you give it another id in this case IID instead of UID (z sorting however is more of layer type of thing it might be that IID is not the best aproach )

  • Try Construct 3

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

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

    > > what newt said or use IID sorting

    > >

    >

    > How would you sort by IID?

    >

    same as you sort them by z-order just you give it another id in this case IID instead of UID (z sorting however is more of layer type of thing it might be that IID is not the best aproach )

    So let me paraphrase your posts:

    1. Try sorting Z Order by IID

    2. IID is not the best way to sort Z order

    lol, am I misunderstanding something?

  • well yea , the problem is the post or problem you made is a bit confusing ... first you say the order you need "As it sounds like if the z order was ABAB it would never get changed to lets say AABB" but z-sorting, or z-order if im not mistaken.... its a overlapping order... not a linear one...thats why i said try IID sorting for AABB then if you want overlapping z-sorting then i dont know.

  • As it sounds like if the z order was ABAB it would never get changed to lets say AABB

    If you want AABB sorting, you might just want to use separate layers for the As and Bs.

  • If the example is throwing people off let me enlarge it—ABABCDAB, if sorted one at a time would never change to ABBACDAB. Bad example—should have at least said ABBA

    But that part of the question I think Newt took care of anyway

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