Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception when loading a tmx file into java using libGDX

When I recently tried to load a basic map I made in Tiled I get the exception: Unsupported encoding (XML) for TMX Layer Data

I looked at the tutorial from badlogicgames website and did the same thing

private TiledMap map;

public void create() {      
     map = new TmxMapLoader().load("data/jf2.tmx");
} 

Here I have put my jf2.tmx file in the assets folder. I then moved all the images files to the same directory. So basically...what am I doing wrong?

like image 510
Johan Avatar asked Aug 25 '26 08:08

Johan


1 Answers

Currently LibGDX (the TmxMapLoader) can't load a map where the data is encode in XML (this is default). You need to set the "Tile Layer Format" in Tiled to csv, base64, gzip or zlib. These are implemented in the current nightly build. You can set the "Layer Format" directly after opening the map in Tiled under Properties.

like image 61
user1863282 Avatar answered Aug 26 '26 22:08

user1863282



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!