Open karai17 opened 9 years ago
Erm, the tilewidth
property should exactly match what you told Tiled about the tile width in the New Map dialog and the Map Properties widget:
writer.writeKeyAndValue("tilewidth", map->tileWidth());
writer.writeKeyAndValue("tileheight", map->tileHeight());
So where does this value of 51 come from?
I think the problem stems from not using the side-length property, but the 51 should be 50 in this scenario, the problem was that the results of having it at 51 and 50 had identical results:
50 comes from tile_width + side_length
, which is what would fix the map if it was staggered along the correct axis and made correct use of the side length property:
As mentioned in #1097, this came from (me) not really understanding the significance of the stagger axis, as it only seemed to modify the map dimensions and didn't seem to correlate with how the hex was oriented with the default side length being zero.
51 rendering the same as 50 has to do with the offset between tiles, which can't be half pixels.
Perhaps forcing this value to always be even would help with this particular confusion? Or maybe throw a warning if someone sets it to odd?
I think the problem is, should I then force it to be always odd, when the tile side length is odd?
I think the idea here is that we need the numbers to export in a way that will not cause errors in a renderer.
I believe this issue is related to issue #1097. Because Hexagonal are actually isometric maps, the value being pushed out to Lua for the tile width is a bit strange. With a hex tile size of 32x32, the map tile width is exported as 51. This causes rendering issues that are only solved by changing the value to 50 in my library.
I think it might be better to treat hex tiles as orthogonal instead of isometric.