  We show, under mild hypotheses, that if each element of a finitely generated
group acting on a $2$-dimensional $\mathrm{CAT}(0)$ complex has a fixed point,
then there is a global fixed point. In particular all actions of finitely
generated torsion groups on such complexes have global fixed points. The proofs
rely on Masur's theorem on periodic trajectories in rational billiards, and
Ballmann-Brin's methods for finding closed geodesics in $2$-dimensional locally
$\mathrm{CAT}(0)$ complexes. As another ingredient we prove that the image of
an immersed loop in a graph of girth $2\pi$ with length not commensurable with
$\pi$ has diameter $> \pi$. This is closely related to a theorem of Dehn on
tiling rectangles by squares.
