0
\$\begingroup\$

Is it possible to rotate an isometric tile map, either in LibGDX or Tiled map editor? My problem is that LibGDX renders the (0, 0) position from Tiled at bottom-left corner like it usually does (see the attachments), however that introduces awkwardness when editing the map as you have to keep in mind that the top corner of the map will be the left corner when rendered in game. Is there any workaround for this?

enter image description here enter image description here

\$\endgroup\$
  • \$\begingroup\$ How do you render it? LibGDX should automatically orient it based on the tile render order \$\endgroup\$ – Bálint Aug 18 '17 at 10:00
  • \$\begingroup\$ In create() method: renderer = new IsometricTiledMapRenderer(assets.map); In render() method: renderer.setView(camera); renderer.render(); \$\endgroup\$ – Shibalicious Aug 18 '17 at 10:07
-1
\$\begingroup\$

It was my mistake, I was passing "flipY = false" as a parameter into my TmxMapLoader!

EDIT:

My bad. Here's a better explanation:

TmxMapLoader.Parameters param = new TmxMapLoader.Parameters();
param.flipY = false;
map = loader.load("data/maps/tiled.tmx", param);

I was passing these parameters when loading my map. I did this because otherwise LibGDX would return different Y coordinates of objects than the ones that are set in .tmx file. However, by passing those parameters, the map loader also changes a few more things, including map rotation. I am not sure why exactly it does that but if you analyze BaseTmxMapLoader class you can see where that parameter is used.

\$\endgroup\$
  • \$\begingroup\$ You could make this a proper self-answer by adding some more explanation for those parameters and where you pass them. \$\endgroup\$ – Philipp Aug 18 '17 at 15:10
  • \$\begingroup\$ It seems the logic that was messing up your map is only written to handle orthogonal maps, but appears to be applied regardless of the map orientation. Could be worth raising that issue on the libGDX issue tracker, or submitting a patch. \$\endgroup\$ – Thorbjørn Lindeijer Aug 20 '17 at 15:12

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.