isometric map render bug

I made an isometric map with the program "Tiled" and loaded it in my code. I have two layers of tiles: 1. The background layer (grass) 2. The objects layer (a fridge in this case) The fridge does not get rendered correctly. As you can see here (left how it should be, right how it is atm)

http://i.stack.imgur.com/UBTDf.png

The firdge consists of two parts, upper and lower part, as seen here:

http://i.stack.imgur.com/iuS47.png

So my first thought was, that I can't display a tile over a tile. That would explain why the grass tiles to the left and the right of the fridge is in front of the fridge. But that does only apply for the upper part. The lower part gets displayed correctly and also "goes over" the grass tile. So why is that happening?


Alright I figured it out. You can render the layers of the map on by one.

map.render(x, y);

Renders all the layer at once. Then what happens is what @Marco13 commented under my question. To avoid that use this instead.

map.render(x, y, layer);

And if you have two layers like me, for example you just go:

map.render(x, y, 1);
map.render(x, y, 2);

Then everything looks just fine :)

链接地址: http://www.djcxy.com/p/71208.html

上一篇: 从LibGdx中的tmx贴图(TiledMap)创建一个Sprite列表

下一篇: 等距地图渲染错误