1
\$\begingroup\$

I'm parsing Tiled maps (.tmx) for my game, and even after reading the documentation, I don't understand what the difference is between the attributes tilewidth and tileheight of the map element versus the attributes of the same name in the tileset element. They are often the same; an example where they differ is the map _isometric_grass_and_water.tmx_ from Tiled's examples folder:

<map version="1.0" orientation="isometric" width="25" height="25" tilewidth="64" tileheight="32">
<tileset firstgid="1" name="isometric_grass_and_water" tilewidth="64" tileheight="64">

Also, there's this child element of tileset whose purpose I don't understand:

    <tileoffset x="0" y="16"/>

Do those distinct values exist for isometric maps? If anyone could shed some light on this, my hurty brain'd be very thankful.

\$\endgroup\$
1
\$\begingroup\$

The map is a grid, where the spacing of the grid is specified as the map.tilewidth and map.tileheight.

Now tiles can be bigger (also smalller, but that doesn't make much sense) than the grid spacing. If the map has a tilesize of 64x64 for example there could be tiles with a size of 128x128 or 64x128. This is useful when you want to overlap the tiles. If no offset is specified these will be drawn from the bottom left corner, this is fine for rectangular tilemaps, but for isometric tiles you are often required to apply a offset.

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.