Here’s the code:
try{
TiledMapTileLayer layer=(TiledMapTileLayer) map.getLayers().get(0);
if (layer.getCell((int)p.getX(), (int)p.getY()).getTile().getProperties().containsKey("a"))
{
System.out.println("COLLISION!");
}
} catch(Exception e) {System.out.println("error coliding"); e.printStackTrace();}
When the player touches a tile with the property “a” nothing happens most of the time. If you go to a certain position near the tile it may print “COLLISION!”. When I clear out all the tiles and cover the whole map with a grass tile that has no property, it does the weirdest thing. if your x is < than 0 or > 99 it points the exception to the if statement. same for the y axis. I have no kind of method that should stop the player from going past 100 x and y. What do I do to convert the player’s position to a tile coordinate?