You can do what you want because it's your simulation. If I were simulating this, I would use the following piece of flowchart that requires only the 1-d equations linking the final velocity components to the initial velocity components.
Start with initial positions ##\mathbf r_{1i},~\mathbf r_{2i}## and velocities ##\mathbf v_{1i},~\mathbf v_{2i}.##
Calculate the tentative final positions using ##\mathbf r_{1f}= \mathbf r_{1i}+\mathbf v_{1i}\Delta t## and ##\mathbf r_{2f}= \mathbf r_{1i}+\mathbf v_{2i}\Delta t##.
If the tentative final positions do not imply a collision, then they become the actual final positions in which case the become the initial positions and you go back to step 1.
If the tentative final positions imply a collision, then the initial positions are kept, and you go back to step 1 with ##\mathbf v_{1f},~\mathbf v_{2f}## becoming ##\mathbf v_{1i},~\mathbf v_{2i}.## I show below how to get these.
A unit vector parallel to the center-to-center direction from mass 1 towards mass 2 is, in terms of the Cartesian axes that you have adopted, $$ \mathbf{\hat n}_{\parallel} =\frac{\mathbf r_{2}-\mathbf r_{1}}{|\mathbf r_{2}-\mathbf r_{1}|} =\frac{ (x_2-x_1)~\mathbf {\hat x}+ (y_2-y_1)~\mathbf {\hat y} } {\left[(x_2-x_1)^2+ (y_2-y_1)^2 \right]^{1/2}}$$ Once you have the parallel unit vector, the perpendicular unit vector can be written as $$\mathbf{\hat n}_{\perp}=\frac{ (y_2-y_1)~\mathbf {\hat x}- (x_2-x_1)~\mathbf {\hat y} } {\left[(x_2-x_1)^2+ (y_2-y_1)^2 \right]^{1/2}}.$$ The velocities before the collision have components in the parallel and perpendicular directions given by, $$ v_{k,\parallel}^{\text{before}} = \mathbf{v}_k^{\text{before}}\cdot\mathbf{\hat n}_{\parallel}~; ~~
v_{k,\perp}^{\text{before}} = \mathbf{v}_k^{\text{before}}\cdot\mathbf{\hat n}_{\perp}~~~~(k=1,2).
$$After the collision, the perpendicular components are the same as before. The parallel components are related to the "before" components as given in the reference in post #2.
What we have done here is calculate the final velocities in a rotated frame where one has a 1d collision along the center-to-center distance which is the direction along which the momentum transfer takes place.