0

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);
            }
        }
    }
Community
  • 1
  • 1
Neomex
  • 1,650
  • 6
  • 24
  • 38
  • In general, it depends on how the tiles can possibly overlap. Both of your example orderings should be usable if the tile graphics don't extend horizontally. What exactly do you mean with "no result?" Do you get no graphics output at all, or is it just messed up? – Hans-Martin Mosner Jul 23 '16 at 11:18
  • Can't get it to start from top, managed to invert so it goes from bottom to up, but thats unusable... – Neomex Jul 23 '16 at 11:20

0 Answers0