package de.gurkenlabs.litiengine.graphics;

import java.awt.geom.Point2D;

import de.gurkenlabs.litiengine.Game;
import de.gurkenlabs.litiengine.entities.IEntity;
import de.gurkenlabs.litiengine.graphics.animation.IAnimationController;

/**
 * The Class LocalPlayerCamera.
 */
public class PositionLockCamera extends Camera {
  private final IEntity entity;

  public PositionLockCamera(final IEntity entity) {
    super();
    this.entity = entity;
    this.updateFocus();
  }

  public IEntity getLockedEntity() {
    return this.entity;
  }

  @Override
  public Point2D getViewPortLocation(final IEntity entity) {
    if (entity == null) {
      return null;
    }

    // always render the local player at the same location otherwise the
    // localplayer camera causes flickering and bouncing of the sprite
    final IAnimationController animationController = Game.getEntityControllerManager().getAnimationController(entity);
    if (entity.equals(this.getLockedEntity()) && animationController != null && animationController.getCurrentAnimation() != null && animationController.getCurrentAnimation().getSpritesheet() != null) {
      final Spritesheet spriteSheet = animationController.getCurrentAnimation().getSpritesheet();
      final Point2D location = new Point2D.Double(this.getFocus().getX() - entity.getWidth() / 2 - (spriteSheet.getSpriteWidth() - entity.getWidth()) * 0.5, this.getFocus().getY() - entity.getHeight() / 2 - (spriteSheet.getSpriteHeight() - entity.getHeight()) * 0.5);
      return this.getViewPortLocation(location);
    }

    return super.getViewPortLocation(entity);
  }

  @Override
  public void updateFocus() {
    final Point2D cameraLocation = this.getLockedCameraLocation();

    this.setFocus(new Point2D.Double(cameraLocation.getX(), cameraLocation.getY()));
    super.updateFocus();
  }

  protected Point2D getLockedCameraLocation() {
    return this.getLockedEntity().getDimensionCenter();
  }
}

@@ -108,137 +108,24 @@
 ine.
-Game;%0D%0Aimport de.gurkenlabs.litiengine.entities.IEntity;%0D%0Aimport de.gurkenlabs.litiengine.graphics.animation.IAnimationController
+entities.IEntity
 ;%0D%0A%0D
@@ -413,24 +413,24 @@
 Entity() %7B%0D%0A
+
     return t
@@ -453,1090 +453,8 @@
 %0D%0A%0D%0A
-  @Override%0D%0A  public Point2D getViewPortLocation(final IEntity entity) %7B%0D%0A    if (entity == null) %7B%0D%0A      return null;%0D%0A    %7D%0D%0A%0D%0A    // always render the local player at the same location otherwise the%0D%0A    // localplayer camera causes flickering and bouncing of the sprite%0D%0A    final IAnimationController animationController = Game.getEntityControllerManager().getAnimationController(entity);%0D%0A    if (entity.equals(this.getLockedEntity()) && animationController != null && animationController.getCurrentAnimation() != null && animationController.getCurrentAnimation().getSpritesheet() != null) %7B%0D%0A      final Spritesheet spriteSheet = animationController.getCurrentAnimation().getSpritesheet();%0D%0A      final Point2D location = new Point2D.Double(this.getFocus().getX() - entity.getWidth() / 2 - (spriteSheet.getSpriteWidth() - entity.getWidth()) * 0.5, this.getFocus().getY() - entity.getHeight() / 2 - (spriteSheet.getSpriteHeight() - entity.getHeight()) * 0.5);%0D%0A      return this.getViewPortLocation(location);%0D%0A    %7D%0D%0A%0D%0A    return super.getViewPortLocation(entity);%0D%0A  %7D%0D%0A%0D%0A
   @O

Remove the additional handling for the focused entity because this was only a result of the the gameloop having a lower updaterate than the renderloop which causes flickering because the position of entities is not updates as often as it is rendered.