private void seekTarget() {
        if (target == null || target.isDead()) {
            isSeeking = false;
            return;
        }

        double targetx = target.getRect().x + target.getRect().width / 2,
               targety = target.getRect().y + target.getRect().height / 2,
               xdiff = targetx - (rect.x + rect.width / 2),
               ydiff = targety - (rect.y + rect.height / 2),
               targetAngle = -Math.atan2(ydiff, xdiff),
               delta = Math.atan2(Math.sin(targetAngle - angle),
                                  Math.cos(targetAngle - angle));

        if (Math.abs(delta) <= agility)
            angle += delta;
        else if (delta > 0)
            angle += agility;
        else
            angle -= agility;

        setXvel(speed * Math.cos(angle));
        setYvel(speed * -Math.sin(angle));
    }