How do I Z Order Sort Effectively?

Get help using Construct 2

Post » Thu Dec 01, 2016 5:25 pm

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:
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
ImageImageImage
B
43
S
26
G
11
Posts: 516
Reputation: 10,473

Post » Thu Dec 01, 2016 7:24 pm

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.
Image ImageImage
B
170
S
50
G
179
Posts: 8,379
Reputation: 113,427

Post » Thu Dec 01, 2016 8:17 pm

newt wrote: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.
ImageImageImage
B
43
S
26
G
11
Posts: 516
Reputation: 10,473

Post » Thu Dec 01, 2016 8:47 pm

what newt said or use IID sorting
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005

Post » Thu Dec 01, 2016 11:23 pm

gamecorpstudio wrote:what newt said or use IID sorting


How would you sort by IID?
ImageImageImage
B
43
S
26
G
11
Posts: 516
Reputation: 10,473

Post » Fri Dec 02, 2016 12:39 am

badmoodtaylor wrote:
gamecorpstudio wrote: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 )
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005

Post » Fri Dec 02, 2016 1:58 am

gamecorpstudio wrote:
badmoodtaylor wrote:
gamecorpstudio wrote: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? :lol:
ImageImageImage
B
43
S
26
G
11
Posts: 516
Reputation: 10,473

Post » Fri Dec 02, 2016 8:22 am

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.
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005

Post » Fri Dec 02, 2016 12:09 pm

badmoodtaylor wrote: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.
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,361

Post » Fri Dec 02, 2016 1:10 pm

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
ImageImageImage
B
43
S
26
G
11
Posts: 516
Reputation: 10,473


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 41 guests