There is this great link: Drawing Isometric game worlds
However, it draws from left side. I am having a hard time adjusting that algorithm. How would you approach drawing it in depth order? And which depth ordering is the proper one?
This:
.. .. 01 .. ..
.. 06 02 ..
.. 11 07 03 ..
16 12 08 04
21 17 13 09 05
22 18 14 10
.. 23 19 15 ..
.. 24 20 ..
.. .. 25 .. ..
Or this? :
...1...
..234..
.56789.
..abc..
...d...
So far I have ported code to Unity C# from that above link, however all experimentations with it yield no result.
void Start () {
terrainObjects = new GameObject[terrainSizeX, terrainSizeY];
for (int x = 0; x < terrainSizeX; x++) {
for (int y = 0; y < terrainSizeY; y++) {
terrainObjects [x, y] = new GameObject ("Tile @ " + x + "-" + y);
terrainObjects [x, y].AddComponent<SpriteRenderer> ();
terrainObjects [x, y].GetComponent<SpriteRenderer> ().sprite = tile;
terrainObjects [x, y].transform.SetParent (this.gameObject.transform);
terrainObjects [x, y].transform.position = new Vector3 ((y * tileSizeX / 2) + (x * tileSizeX / 2),
(x * tileSizeY / 2) - (y * tileSizeY / 2), 0);
}
}
}