1
\$\begingroup\$

enter image description here

enter image description here

The first picture is what I have in the editor and the second one is what I got when I rendered my map.

@Override
public void init(GameContainer container) throws SlickException {
    this.container = container;
    this.map = new TiledMap("/src/main/resources/map/test2.tmx");
}

@Override
public void render(GameContainer container, Graphics g) throws SlickException {
    this.map.render(0, 0);
}

I would expect the two to be the same, but they're not. Why is that?

Edit : I solved the problem by removing the margin when I imported my tilset

\$\endgroup\$
2
  • 4
    \$\begingroup\$ When you solved the problem yourself, please post an own answer. That way you prevent the Community bot from annoying us by bumping the question up again and again because it doesn't consider it answered yet. \$\endgroup\$
    – Philipp
    Commented Jun 6, 2016 at 22:48
  • \$\begingroup\$ I suggest moving away from Slick2D. Try LibGdx. \$\endgroup\$
    – Sneh
    Commented Aug 23, 2021 at 23:34

1 Answer 1

0
\$\begingroup\$

I'm not sure about in Slick2D, but in Unity this sort of problem can be caused by the engine not assigning indices to wholly transparent blocks. For example, if tiles 2-4 are totally transparent, Tiled would assign the fifth block as index 5 but Unity would assign the 5th block as index 2.

Work-arounds may include slicing a dummy image with a solid color and then overwriting it with your final image to keep the slicing information metadata, or just not having wholly transparent blocks in your tilesheet.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .