for (int x = 0; x < tiledMap.getWidth(); x++) {
for (int y = 0; y < tiledMap.getHeight(); y++) {
for (int l = 0; l < tiledMap.getLayerCount(); l++) {
int tileID = tiledMap.getTileId(x, y, 0);
if (tileID == 1) {
result.add(new Bloque(x, y, Bloque.PARED, true));
}
if (tileID == 2) {
result.add(new Puerta(x, y, Bloque.PUERTA, true));
}
if (tiledMap.getLayerProperty(l, "underPlayer", "-1").equals("1") && tiledMap.getTileImage(x, y, l) != null) {
result.add(new Bloque(x, y, Bloque.CAPA1, false, tiledMap.getTileImage(x, y, l)));
}
if (tiledMap.getLayerProperty(l, "underPlayer", "-1").equals("0") && tiledMap.getTileImage(x, y, l) != null) {
result.add(new Bloque(x, y, Bloque.CAPA2, false, tiledMap.getTileImage(x, y, l)));
}
}
}
}
return result;