In class:
OrthographicCamera camera;
in constructor:
camera = new OrthographicCamera(Width, Height);
camera.setToOrtho(false);
in render method:
camera.position.set(player.x, player.y);
camera.update();
batch.setProjectionMatrix(camera.combined);
The last line is what was missing from all those tutorials, and the single line that makes the difference.
No comments:
Post a Comment