VX = GX - OX VY = GY - OY VM = SQRT(POW(VX,2)+POW(VY,2)) 'magnitude 'find unit vector UX = VX/VM UY = VY/VM 'UX and UY are then your unit vector values in the X and Y directions and can be used in movementor something like thatG is gravity point, O is object