That doesn't work (unless I misunderstood something, which is quite possible).
Here's the code:
Code:
POINT ptStart, ptEnd, ptMob;
DeltaX = ptEnd.x - ptStart.x
DeltaY = ptEnd.y - ptStart.y
K = DeltaY / DeltaX
M = ptStart.y - K * ptStart.x
Y = K * ptStart.x + M
ptMob.x = ptMob.x + 1
ptMob.y = ptMob.y + K
With the following initial settings:
ptStart.x = 5
ptStart.y = 200
ptEnd.x = 200
ptEnd.y = 20
ptMob.x = ptStart.x
ptMob.y = ptStart.y
It gives me this:
DeltaX = 195
DeltaY = -180
K = -1
M = 205
Y = 200