# Line Generation Help

• Hi everyone, I am in deep need of assistance!
I have a 2.5d cube, it is in 5 different parts. This cube turns into a line using the 'Spawn on Object' behaviour. But when the line goes right the z orders are set properly, when the line goes left Part of the right side of the line appears on top of the left side. How can I fix this?
I understand this must makes absolutely no sense, so I will get screenshots that you can all hopefully make sense of.

• This is the code I used to clone the square and make the line. Then I attempted to change the z order with every tap below it, but it didn't work.

This is what the line looks like. All help would be much appreciated :)

• The sooner I can get a response the quicker I can get back to work :)

• Is the image above an example of the line going to the left?

• It's of the line going right then left, As you can see when going right the line is clean but when going left the line has an annoying clone on it from the right side.

• Can't you try to make a system to detect whether it's going left or right, if it's going left it won't even spawn the triangles used for right and if it's going right it won't spawn triangles for left?

• Never mind, I've tried it and ended up with a new problem.
This is the code I now have to generate the line

But it has created this problem

Do you know how I might be able to fix it?

• Ok I've done more code, part of it seems to work. But it is also lagging out my game after time. Here is the code

This is the outcome

I believe I'm getting close, but something isn't working right... any ideas?

• @Evolution I'm a bit confused... is there a reason your line is made of so many parts? Couldn't you just use a single graphic for each cube? If you do you can set the z order of each cube to (y × -64) I think (used 64 so cubes will have separate z orders as long as they aren't within 1/64th of a metre of each other).
Edit: had wrong z order formula.

• I've fixed it don't worry. However I need the seperate parts so that all the z layers work. If it was all one texture, upon duplication and mainly when you turn the Z layers wouldn't look right.

• @Evolution why not? It's at a fixed angle, if you set the z layers right it should work with a single graphic per cube, right?