Call our random variable $W$ instead of $X$. This is because it is useful to give $x$ and $y$ their traditional geometric meanings.
We want the probability that $W\le w$. Draw the line $x+y=w$. Then $\Pr(W\le w)$ is the area of the part of the square which is "below" the line. This is clearly $0$ if $w\lt 0$, and $1$ if $w\gt 2$. Sketch several such lines, say for $w=1/2$, $w=1$, and $w=3/2$.
For $w\le 1$, the part of the square below the line is just a right triangle whose "legs" are $w$ and $w$. This is because the line meets the $x$-axis at $x=w$, and the $y$-axis at $y=w$. The area of this triangle is $w^2/2$. So if $0\le w\le 1$, then $\Pr(W\le w)=w^2/2$.
For $1\lt w\le 2$, the part of the square below the line has area $1$ minus the area of the part of the square above the line. This part is just a triangle, with easily computed area. For let us find the legs of this triangle. If $w$ is between $1$ and $2$, the line $x+y=w$ meets the line $x=1$ at $y=w-1$. So the triangle has legs $1-(w-1)=2-w$, and therefore area $(2-w)^2/2$. So if $w$ is between $1$ and $2$, then $\Pr(W\le w)=1-(2-w)^2/2$.