# Isometric Z order for long objects

Get help using Construct 2

### » Sat Feb 09, 2013 12:12 pm

Hi guys.
I have the following problem.
Im making isometric rts and for Z order I find This Plugin quite helpfull, with 1 major problem for me. It doesnt really work for long objects at 45%.
Here is some illustration of what i mean:

Here is the perfect situation and everything works fine

Here is the problem. The green boxes are situated allright on z, but the red ones wont be ok.

Here is what exactly im trying to solve. Imagine there is a unit infron of the wall.

Does anyone have an idea how i can manage this?
Thanks

B
12
S
3
G
1
Posts: 120
Reputation: 1,829

### » Sat Feb 09, 2013 2:05 pm

Most z ordering is actually based on the individual objects y.
Unfortunately an object can only have one y, therefore if an object is bigger than the isometric cell size this z ordering wont work.
Your solution is to make the objects smaller, or cut them up to fit together.
B
175
S
50
G
199
Posts: 8,626
Reputation: 124,028

### » Tue Mar 05, 2013 2:27 am

Just a few ideas....
I am testing a few of these today...
pretty sure they will work...

Yes making smaller wall segments is an option but you could also try adding a few instance variables to the Wall segment and Store "fake" Y coordinates in them...

Determined by getting the BASE Y of the wall segment and then subtracting divisions of measurement to create the Variable "fake" Y positions.

then if you game is more or less tiles based you can compare the Units Y axis to the Fake Y coordinates of the wall segment....if you know what I mean...

For example a Wall segment that was 100 pixels wide but spanned say, 100 pixels in Y coordinates..then you could break the Variables up into proportionate "fake" Y coordinates... at each respective jump in Y difference....Does that make sense?

Of course you will still need to refine it..but it seems that you are using a sort of Grid based snapping system? try to incorporate that into your grid system...if you are not using a snap to position grid then It may be alot harder....

You could also use image Points to enable snap to positions set at any interval you like along the wall edge ..then when your attacking units
get close to the wall you could Snap them to the image points position...

Or even easier, place a small invisible marker sprite at the wall edge image points which you set up in the animations editor..(let's call them "Attack points")

Then you can very easily "direct" your attacking units to the wall segments "Attack points" via the "Set VECTOR" or "Set angle of motion to object" or similar functions

Example image
mystazsea2013-03-05 02:52:58
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
36
S
13
G
8
Posts: 318
Reputation: 7,710

### » Tue Mar 05, 2013 6:57 am

Here is a technique for isometric sorting with any sized blocks:
http://bannalia.blogspot.com/2008/02/filmation-math.html
The concept is simple, take any two visually overlapping blocks and you can calculate which should be drawn first by comparing their positions and sizes in isometric coordinate space.

The second part of it is a bit trickier, which involves sorting by that comparison. It's apparently a topological sorting problem but it can be thought of in a simpler way.

1. Make a list for each block of the blocks that need to be drawn first.
2. Keep track of what blocks have been drawn.
3. Draw the blocks whose list contains only drawn blocks.
4. repeat 2 and 3 until all blocks are drawn.

EDIT:
Here is a test:
http://dl.dropbox.com/u/5426011/examples17/iso3.4.13.capx
Sorting fails if any objects are overlapping in isometric space or if there is a loop of blocks that need to be drawn before each other.R0J0hound2013-03-05 08:38:48
B
97
S
36
G
131
Posts: 5,513
Reputation: 83,464

### » Tue Mar 05, 2013 1:52 pm

Thanks for the time you guys spend to help with my problem.
I'm mere an 3D artist so I'm trying to keep the game as simpler as i can. Math is not one of my best skills.
mystazsea I think i got what your idea is and it sounds reasonable, but still i prefer using the z order plugin, it saves me a lot of headache.
R0J0hound i tried several times to understand the tutorial you linked, before i post that question. Well I'm helpless :)
Anyways i figure i can do this:

Cut the walls in half horizontally. So the upper part covers the units behind the wall, and the lower is staying behind the units infront of it. Problem is that there should be no taller than the cutline units and sprites but i hope it wont be a problem.Pakost2013-03-05 13:54:36
B
12
S
3
G
1
Posts: 120
Reputation: 1,829

### » Wed Aug 14, 2013 4:30 am

i'm trying to make a similar game but drop and drag walls with touch and i'm having an issue with the walls being in front of or behind each other when dropped in place. i have read alot on it and looked at many post just cant figure out the best way to make an item go behind or infront of an another item so it looks like an iso wall.
B
14
S
4
G
1
Posts: 39
Reputation: 2,756