我发现了导致错误的原因:
1)我的“ packfile”中的所有图块均以-1作为其索引
2)我的“ packfile”中的所有图块均具有与原始图块文件名称相同的名称,但与包含所有打包图块的.png文件。
当前我的屏幕是黑色的,所以我认为没有绘制图块(可能是因为我对packfile中的图块提供了随机索引-已 修复,请参见文章末尾
),但是没有引发异常,这就是重点。
这些错误是由于我以前打包程序的程序造成的,该程序应该让我赢得时间大声笑。因此,我将尝试其他选项或使用其他选项。
如果您想知道该程序是“ TexturePacker GUI” v3.1.0。
如果您知道为避免错误我不应该使用的选项,请告诉我。
编辑: 找到了一个有用的打包瓷砖的工作工具,这里是:http ://freigabe.philweb.de/bubblr/texturepacker_edited.jar
(链接已死;请改用此== http://bit.ly/ 1a831nv或其他打包工具=>
http://bit.ly/1aLgAFt)
要使用它,请打开cmd并转到下载.jar文件的目录,然后:
//You should create, in the same directory of the .jar file, two additionnal folders//Call the first folder 'input' and put in all your tiles (rename them "level_1.png", "level_..")//Call the 2nd folder 'output' and leave it empty//Then just type in the command prompt : java -jar nameOfDownloadedJarFile.jar input output level//Then rename the "input1.png" into "level.png", and "level.pack" into "level packfile"//Open "level packfile" with notepad and change "input1.png" into "level.png"//Then draw your map using "level.png" in TiledMapEditor//Then just follow dpk' tutorial for rendering the map and it should work
这是我提到的dpk教程,只需从这里开始:http ://dpk.net/2011/05/01/libgdx-box2d-tiled-
maps-full-working-example-part-1/#p4
如果应用程序没有崩溃但屏幕为黑色,则只需增加摄像机视口的宽度和高度即可。
快乐的映射:)!



