map.getTileId(0, 0, objLayer); //this one in particular
This line is not necessary. The method getTileID( int x , int y , int layerID ) will return the id of the tile placed at the position (x|y).
int objLayer = map.getLayerIndex("Objects");
This line will get you the layerID of the layer with the name "Objects". So basically you will have to have a look at your tile map file. In your tile map you can have multiple layers. Go to your map editor and search for the name of the layer where the tiles to collide with are placed. You can for example go and create an extra layer called "Objects" and then place tiles to collide with on that layer.
After you found that name you use getLayerIndex( String layerName ) to get the layerID of this layer as an integer.
Later on you can use that value in getTileID( int x , int y , int layerID ) to get an specific tile id on that layer. The last thing to take care about is, that you want to make sure wich tile has wich id.
One simple way to check your code would be to print the result of getTileID( int x , int y , int layerID ) in every if statement. With that you will see the object ids and you will see if it works.
Simply put that into every if statement, for example:
if(input.isKeyPressed(Input.KEY_LEFT)){
System.out.println( "Try to walk left.Tile id left to the player is:"+
map.getTileId(x-1, y, objLayer) );
if(map.getTileId(x-1, y, objLayer) == 0){
x--;
}
}
So check for 1. the right layer name 2. the right tile id
With best regards, Chin