libgdx/libgdx — pull request #430 by dylanetaft (2013-05-28 01:24:18+00:00)
Title: Add support for GID attribute

So, long story short
https://github.com/bjorn/tiled/issues/91

In Tiled, the y coordinate value is inconsistent between rectangle objects vs tile objects.
For example, set your tile size to 32x32 in tiled.
Add an object layer.
Add a rect to the object layer, position 0,0, width 1, height 1. It will be in the upper left corner of the map.
Add a tile object from your tileset. The map starts at 0,1.
I tried building the latest nightly of Tiled from GIT, the issue is still there.

However, what is the most elegant way to deal with with LibGDX?
x and y are added to the Object properties. This issue only occurs with Tiled map objects that are "tile" based, where they have an image. This uses the "gid" attribute in XML for Tiled.

So, a programmer, if gid is exposed, now has a way to deal with this. They can offset the object up 1 tile.

This should be a harmless change to support it. Additionally, this gives the flexibility to assign an image to a Tiled map object based on GID instead of doing something else, if someone wanted to.

If this is inappropriate, setting a property manually on such an object is a workaround, ie, "hasYCoordBug" or something similar.

The underlying issue is that there's no way to determine once you load a map with TMXMapLoader what is a "rect" and what is a "tile" based object. This gives a way, if it has a gid, it's a "tile" based object.