Assume $X$ is a compact metric space and $Y$ is a metric space, where $X$ and $Y$ are both connected. Assume $f:X\rightarrow Y$ is continuous. Define the map $g:X\rightarrow \mathbb{R}$ by $g(x)=d(f(x),Y\backslash f(B_{r}(x))$. Is this map continuous? Assuming $f(B_r(x))\neq Y$. Due to comments, ...