Contributor: Kartik Shrivastava
Project: Add Tiled compatibility to/from Enigma
Guided by: bjorn, fundies and Josh
Setting Room width and height of an isometric map remains the same as of orthogonal maps i.e. numHorizontalTiles * tileWidth and numVerticalTiles * tileHeight respectively.
Just little work as to be done to arrange isometric tiles in the Room.
To get the x coordinate of top-left corner of the tile, I first get the position of the first tile of the corresponding row which I called xStart, and then add currentRow * tileWidth / 2 to it. Calculation of xStart is quite interesting because it takes into account the currentColumn of the map/room, check the comments in the below code snippet to get a sense of how it is computed. Finally, to get y coordinate of top-left corner of the tile we take into account both currentColumn and currentRow, we multiple both by tileHeight / 2 and add the result.
Like hexagonal maps, isometric maps also have staggerness. So at first I separated out staggerAxis and staggerIndex into its own struct like below.
Room width and height computation of staggered maps requires slight attention. Due to staggerness in horizontal and vertical directions, width and height of the Room has to be adjusted accordingly. So if the given map is "x" staggered, then we set Room width as numHorizontalTiles * tileWidth / 2, and in case of "y" staggered maps, we set Room height as numVerticalTiles * tileHeight / 2. Height and width of Room in above cases remains same as of orthogonal maps, check out the snippet below for exact details.
Now because of stagerness in the map we need to compute tile arrangement differently as well.
These two addition wraps ups the support to all map format present in Tiled right now, so in coming weeks my goal will be to slowly and gradually move to start integrating EGM importer in Tiled. Thanks for reading!