There is an awful flickering that happens occasionally on my screen from top to bottom. It only happens when the camera moves around (which follows my player character). It does not matter where I am on the map for this to happen. If I stop moving at the right moment, the lines will remain visible until I start moving again. I've added a screenshot so you can see what it looks like:


If you look closely, you might notice that the lines represent a part of my "mountain wall" tile (That tile is used a little bit lower in the map):

Mountain Wall

I've tried putting the cam.update() in the beginning of the update() method, as some other people on StackOverflow have suggested, but that doesn't seem to work. I have also made sure that there is absolutely no space in between tiles in the tileset image. Most questions I see about this issue experience a different kind of flickering than I am.

Here is the code of my screen and all the rendering that happens:

    public PlayScreen(MyGame game){
        cam = new OrthographicCamera();
        batch = new SpriteBatch();
        gameMap = new TestMap(startMap);
        player = new Player(this);


    public void update(float delta){

        Rectangle playerRect = player.getNextRectangle(delta);
        Rectangle teleportRect = gameMap.teleportTo(playerRect);

        if(teleportRect != null){

        cam.viewportHeight = / zoomLevel;
        cam.viewportWidth = / zoomLevel;

        cam.position.x = player.getX() + (player.getWidth() / 2);
        cam.position.y = player.getY() + (player.getHeight() / 2);

    public void render(float delta) {
        update(delta);, 0, 0, 1);;

        gameMap.render(cam);"FPS: ";

0 Answers