2

everybody, I'm making an android game using java and libgdx. I'm also using Tiled to render my tiles on the screen. I hava the camera set up already, all I need is to figure out how to not render tiles that are not shown on the screen. Here is the code

testRenderer.setView(main.getOrthographicCamera());
testRenderer.render();
main.getOrthographicCamera().position.set(main.getPlayer().getX() + (Main.PLAYER_WIDTH / 2), main.getPlayer().getY() + (Main.PLAYER_HEIGHT / 2), 0);
main.getSpriteBatch().setProjectionMatrix(main.getOrthographicCamera().combined); 
setBoundsToCamera();
main.getOrthographicCamera().update();

1 Answers1

0

You don't have to do it. OrthographicCamera.update() is taking care of it by itself. All you have to do is define viewport size.

Dawid Fieluba
  • 1,271
  • 14
  • 34