It works for me, but math isn't my strong side though
All that function does is receiving the current position of the object and then subtracts the position from the final position.
Let's say you have an object at x980 y530
You want to move it at x50 y50
50 - 980 = -930
50 - 530 = -480
Or
Let's say you have an object at x980 y530
You want to move it at x1500 y700
1500 - 980 = 520
700 - 530 = 170