Why is my Tiled map distorted when rendered with LibGDX?
- by Sean
I have a Tiled map that looks like this in the editor:
But when I load it using an AssetManager (full static source available on GitHub) it appears completely askew.
I believe the relevant portion of the code is below.
This is the entire method; the others are either empty or might as well be.
private OrthographicCamera camera;
private AssetManager assetManager;
private BitmapFont font;
private SpriteBatch batch;
private TiledMap map;
private TiledMapRenderer renderer;
@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
assetManager = new AssetManager();
batch = new SpriteBatch();
font = new BitmapFont();
camera.setToOrtho(false, (w / h) * 10, 10);
camera.update();
assetManager.setLoader(TiledMap.class,
new TmxMapLoader(
new InternalFileHandleResolver()));
assetManager.load(AssetInfo.ICE_CAVE.assetPath, TiledMap.class);
assetManager.finishLoading();
map = assetManager.get(AssetInfo.ICE_CAVE.assetPath);
renderer = new IsometricTiledMapRenderer(map, 1f/64f);
}