Seems basic enough, but I can't seem to find the answer: I am trying to implement collission detecton and for that I need the properties of the tile the player is currently entering. I am using gdx.maps.tiles.TiledMap, which does not have a getCell(int x, int y) like the older TileMap had. Any help on this specific issue or just some general advice on how to do this will be much appreciated!


With the new libGDX tiled maps implementation, you need to request the concerned layer before being able to request for a particular tile.


TiledMapTileLayer layer = (TiledMapTileLayer) currentMap.getLayers().get("layer_id");

And then i can do:

layer.getCell(x, y);

Which will return a Cell instance.

Here is the new documentation about tile maps: https://github.com/libgdx/libgdx/wiki/Tile-maps

| improve this answer | |
  • \$\begingroup\$ Thank you very much! I did already use layers, but I didn't use the cast, which was the problem. \$\endgroup\$ – Ghyl Dec 27 '13 at 13:46

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.