I would really appreciate it :D
// instance fields private Actor player = null; private int distanceToPlayer = 0; // in act if (player == null) { for (Object obj : getWorld().getObjectsInRange(200, Player.class)) { player = (Actor)obj; distanceToPlayer = (int)Math.hypot(getX()-player.getX(), getY()-player.getY()); break; } } else { if (player.getWorld() == null || Math.hypot(getX()-player.getX(), getY()-player.getY()) > 200) { player == null; } else { int dist = (int)Math.hypot(getX()-player.getX(), getY(), player.getY()); if (dist-2 < distanceToPlayer) { turnTowards(player.getX(), player.getY()); move(2); } distanceToPlayer = (int)Math.hypot(getX()-player.getX(), getY()-player.getY()); }
player = null;
if (player == null) { // place code here }