1. You did not do the same as I suggested. You are still using the code as:
            dxx = vx / velocity;
            dyy = vy / velocity;
            velocity -= a * dt;
Applied the change to vx,vy directly.

2. if(vx<0) vx=0; // this only work if vx>0 at t=0, what if vx<0 at t=0;