Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In my project, I'm trying to render a map using TileMapRenderer. But it doesn't show anything when I render it. But when I use some other files from a tutorial they are rendered correctly.

When debugging my TileAtlas instance shows the size as 0.

I have used Texture Packer UI for packing the images. Comparing with the tutorial's files, I can see that the index starts from 1 in my file and 0 in the tutorial. But changing it to 0 wouldn't work also.

map.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
Map
  rotate: false
  xy: 0, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 1
Map
  rotate: false
  xy: 32, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 2
Map
  rotate: false
  xy: 64, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 3
Map
  rotate: false
  xy: 96, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 4
Map
  rotate: false
  xy: 128, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 5

Here is the begining of the tmx file.

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="20" tilewidth="32" tileheight="32">
 <tileset firstgid="1" name="a" tilewidth="32" tileheight="32">
  <image source="map.png" width="256" height="32"/>
 </tileset>
 <layer name="Tile Layer 1" width="20" height="20">
  <data>
   <tile gid="2"/>
   <tile gid="2"/>

Apart from that the tutorial files and my files seems to be similar.

Can anyone help me here.

share|improve this question
    
As the problem wasn't solved, I used another texture packer mentioned in link and was able to get it to work. Could be most probably a bug in the texture packer –  SankaD Dec 20 '12 at 14:27
add comment

1 Answer

I think you need to use the TiledMapPacker (com.badlogic.gdx.tiledmappacker.TiledMapPacker from gdx-tiled-preprocessor.jar), and NOT the Texture Packer GUI.

Usage:

libgdx/dist$ java -classpath ./gdx.jar:
        ./extensions/gdx-tools/gdx-tools.jar:
        ./extensions/gdx-tiled-preprocessor/gdx-tiled-preprocessor.jar 
    com.badlogic.gdx.tiledmappacker.TiledMapPacker 
    ~/artifacts/input/ 
    ~/artifacts/output/ 
    --strip-unused

TiledMapPacker builds a packfile where as Texture Packer GUI builds a .pack file.

checkout this article that explains about packing (http://code.google.com/p/libgdx-users/wiki/Tiles#Packing). Make sure you have cross checked all the points he mentions, under the above section.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.