public Creep findCreep() {
        if (locked && lastCreep != null && tower.getContext().getCreeps().contains(lastCreep) && lastCreep.isValidTarget()) {
            float distanceMin = tower.getRange() * tower.getRange();
            float dX = (lastCreep.getX() + Grid.SIZE / 2) - (tower.getGrid().getLocation()[0] + Grid.SIZE / 2);
            float dY = (lastCreep.getY() + Grid.SIZE / 2) - (tower.getGrid().getLocation()[1] + Grid.SIZE / 2);
            // squared distance
            float dist = dX * dX + dY * dY;
            if (dist < distanceMin) {
                return lastCreep;
            }
        }

        lastCreep = null;
        Creep found = null;
        int size = tower.getContext().getCreeps().size();
        int health = Integer.MAX_VALUE;
        float distanceMin = tower.getRange() * tower.getRange();
        for (int i = 0; i < size; i++) {
            if (tower.getContext().getCreeps().get(i).isValidTarget()) {
                float dX = (tower.getContext().getCreeps().get(i).getX() + Grid.SIZE / 2) - (tower.getGrid().getLocation()[0] + Grid.SIZE / 2);
                float dY = (tower.getContext().getCreeps().get(i).getY() + Grid.SIZE / 2) - (tower.getGrid().getLocation()[1] + Grid.SIZE / 2);

                // squared distance
                float dist = dX * dX + dY * dY;
                if (dist < distanceMin && tower.getContext().getCreeps().get(i).getHealth() < health) {
                    health = tower.getContext().getCreeps().get(i).getHealth();
                    found = tower.getContext().getCreeps().get(i);
                }

            }
        }
        lastCreep = found;
        return found;
    }