How do I set Z order by Y using Family?

Get help using Construct 2

Post » Sat Jul 16, 2016 8:11 am

I have a Function called Sort, it goes like this


For each Object order by Object,Y ascending.
Object Move to top of layer


The above way is working the way it should. If I change 'Object' to a 'ZOrderFamily' it stops working correctly. I only have two different objects in the 'ZOrderFamily. If I remove the second object and only have the original 'Object' in the family it still doesn't work correctly. It doesn't Z-Order them correctly.


For each ZOrderFamily order by ZOrderFamily,Y ascending.
ZOrderFamily Move to top of layer


All I did was change the Target Object to a Family and it stops working. I am not sure how else to Z-order using an objects Y than what I have. I can only assume 'For each' may be the problem since I went from an object to a family.

I need to know what I am doing wrong. Nothing else is effecting the objects Z-Order because there is nothing else I have that can effect it. The only events associated with the objects are the ones used to create them. The 'Sort Function is called a tick after they are created (Wait 0 Seconds). All of the objects are on the same layer. The 2nd object will always be created between a few of the original objects, so they seemingly need to be Z-ordered together.

Can someone please tell me what condition/expression to use or another way to do this so it works.

Thank you for your time. I may have a slow reply, but it will be appreciated.
B
59
S
33
G
13
Posts: 223
Reputation: 12,105

Post » Sat Jul 16, 2016 8:20 am

There is a new feature in the system action called sort Z-order by:

add a family variable called Zy. Then create

Is on screen:
---> set Family.Zy (variable) to Family.Y
---> sort Zorder by Family.Zy

That's the easiest way.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 945
Reputation: 12,212

Post » Sat Jul 16, 2016 7:16 pm

I can't make this work with a family.

Whatever i try, the instances get a new Z order number relative to each other, not relative to the members of the family.

I would really aprecitate a working capx, Z sorting members of a family. A family that contains differend sprites.

Not that it is a big problem for me. I use rex_zSorter by rexrainbow. And lately i am experimenting with the Isometric Behavior by R0J0hound. Both have theire (normal) problems with stacked objects. Wich i try to tackle.
B
33
S
18
G
28
Posts: 2,479
Reputation: 20,922

Post » Sat Jul 16, 2016 11:06 pm

So what condition do I use then? Setting the Family Variable and Sort Z Order are both actions.

The condition I have organizes by ascending Y. I don't need that as a condition if Sort Z Order using the YVariable will be an action. Do I just leave it blank?
B
59
S
33
G
13
Posts: 223
Reputation: 12,105

Post » Tue Jul 19, 2016 2:05 pm

@tunepunk

Working isometric platform model.
https://drive.google.com/open?id=0B1SSu ... mtWVnc1cDg

Using @R0J0hound 's behavior.
behavior-isometric_t153967

I am PRETTY suprised with how nice this behavior does the Z sort & handles the Z-moving.

The layout is in layers, to easely build a level. On runtime it corrects for the layer offsets and brings all objects to 1 layer. Another awwsome plus for this behavior.
B
33
S
18
G
28
Posts: 2,479
Reputation: 20,922

Post » Tue Jul 19, 2016 3:27 pm

@99Instances2Go Thanks. I looked at it, but I'm not using exactly 2:1 isometric and not grid based, so i can sort all kind of object sizes and shapes, in any angles. ;)
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 945
Reputation: 12,212


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, DuqueKarl, Vinterstille and 3 guests