How to Use tiled-Map-processor in libgdx

Source: Internet
Author: User
Tags libgdx

I learned (12)-I encountered a bunch of problems when using the tiledmap. I was so sad for several days.

1. Process tmx files

The document says: Use the tile map editor tool to create a tmx file and then use GDX-tiled-Preprocessor to process it. After processing is completed, three more files will be added to overwrite the original file with the same name.

In the end, I encountered a problem. I did not reply to the author on Weibo. I went on to find a solution and finally met a netizen. Here are some solutions:

1) After the tmx file is created, check the image path used. It cannot be an absolute path: (I changed it to a relative path)

Open the tmx file in text format and find the source = "screenshot-isometric.png". If it is an absolute path, copy the image and change it to a relative path.

2) use GDX-tiled-Preprocessor to process tmx files

The libgdx I'm using is the latest 0.9.8, where there is a gdx-tiled-preprocessor.jar file, as described online,

Create a folder (any name of tiledmap can be used), store the JAR file, create two subfolders: In and out, and put the tmx file and the image file used into the in

Run the Java-jar gdx-tiled-preprocessor.jar in out command in the tiledmap file.

Finally, my solution is to put GDX. Jar under the tiledmap file (which is easy to find), gdx-tools.jar (under the extensions/GDX-tools directory) and gdx-tiled-preprocessor.jar Three jar

Run the java-classpath gdx. jar; gdx-tools.jar; gdx-tiled-preprocessor.jar com. badlogic. gdx. tiledmappacker. TiledMapPacker in out

Done.

************ ******************

2. Error: com. badlogic. gdx. utils. GdxRuntimeException: Error reading file: map/tmw-desert-spacing packfile (Absolute)

Solution:

Atlas = new TileAtlas (map, new FileHandle ("data/map /");

Atlas = new TileAtlas (map, Gdx. files. internal ("data/map/"); OK

3. Error: java. lang. IllegalArgumentException: Bad position (limit 0): 8

Error reported by code tileMapRenderer. render (c); (c is the camera variable obtained from the stage)

This problem has plagued me for a few nights and I have not found any answers on the Internet ............

Finally, I accidentally discovered that there was a problem with image creation. I couldn't open the tmx file when I opened it with Tiled Map Editor... A few days ago ...... depressing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.