Libgdx tiledmappacker and texturepacker tools

Source: Internet
Author: User
Tags libgdx

 

 

Original link http://blog.csdn.net/cng1991/article/details/7288234

After studying libgdx today, we can see that the libgdx engine can load the. tmx file generated by the tiled map tool. So I really want to try to load the. tmx file, which must have a packfile similar description file, which can be generated by GDX-tiled-Preprocessor.

Under the guidance of the https://code.google.com/p/libgdx/wiki/TiledMaps, libgdx \ extensions \ GDX-tiled-Preprocessor is imported into your own project and the class package is loaded. Run the tiledmappacker. Java file. An error occurred, and Google could not find a solution. As a result, I searched for tilemap in the author's Forum. When foreigners use the tiledmappacker class, they also encountered many problems. One of the questions was answered to solve the problem. Is a blog http://dpk.net/2011/05/01/libgdx-box2d-tiled-maps-full-working-example-part-1/ written by foreigners. If you can understand it, you are advised to read the original text. The original text mainly teaches you how to integrate several images into one and generate a packfile description file, and. combined with tmx, The libgdx engine can be loaded. tmx file.

The following describes how to load. tmx using libgdx.

First, download the demo file jumpertutorialprojects.zipumpertutorialprojects.zip of the English document. If you can not connect to this site, I have been uploaded to my csdnresource library, called jumpertutorialprojects.zip,: http://download.csdn.net/detail/cng1991/4085013

After downloading umpertutorialprojects.zip, unzip the project texturepacker and import it to eclipse.

Right-click Export-> runnable jar to generate the JAR file.

Create an input and output folder in the same directory of the exported JAR file. Obviously, input stores the original image file, and output stores the exported file. Here are the images you can use to place several tilemap tools in the Input Folder. Call the CMD command window, run the CD command to enter the directory where the jar is located, and then enter Java-jar texturepacker. Jar input output level. Input output level is three parameters, input and output are the newly created folder, and level is the name of the generated file, which can be changed according to the actual situation. In this way, you can generate

One of the two files is a large image that is integrated with multiple images, and the other is a pack description file.

Here you can use tileatlas to load small images before conversion.

Of course, to load the. tmx file, you need to import the generated large image into the tilemap tool as a resource for plotting. Export the tmx file and change pack to XXX packfile. This is what the author needs to change. You can try again.

In this way, all the files required to load. tmx are available, so you can write code to load the. tmx file.

All jumpertutorialprojects.zip files are available in the example file.

I just wrote a blog, but I am confused and confused. Sorry... But I will try to improve my writing skills ..

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.