LibGDX drawing map using tiles without space

Posted by Enayat Muradi on Game Development See other posts from Game Development or by Enayat Muradi
Published on 2014-06-11T17:21:47Z Indexed on 2014/06/11 21:43 UTC
Read the original article Hit count: 255

Filed under:
|

I am making a board game. To draw the map on the board I use different tiles. On some screen the map looks good but on some other screens there is a space between the tiles. How can I do so there won't be any space between the tiles?

I am designing my game with the size 480x800. To fit other screens I stretch it.

My tiles looks like this: enter image description here

I draw the map using a for loop to draw the tile in different (x,y) position on screen.

Here is what I mean with space between tiles: Screen with 240x400 enter image description here

Screen with 360x600, here there is no spacing between tiles.

I use camera and the screen to draw I don't use stage. I have also tried to use Viewport but I get the same results.

  cam = new OrthographicCamera();cam.setToOrtho(true, gameWidth, gameHeight);
  batcher = new SpriteBatch();
  batcher.setProjectionMatrix(cam.combined);
  shapeRenderer = new ShapeRenderer();
  shapeRenderer.setProjectionMatrix(cam.combined);

How can I do to solve the problem?

© Game Development or respective owner

Related posts about java

Related posts about libgdx