Game math (distance increments)
I have 2 points (start, end) represented by POINTS (ptStart, ptEnd). The 2 points represent the barrel of the players gun and the target, respectively (it's a 2d iso game).
I know that to get the distance between the points I would use:
distance = sqrt(((ptEnd.x-ptStart.x)*(ptEnd.x-ptStart.x))+((ptEnd.y-ptStart.y)*(ptEnd.y-ptStart.y)))
What I don't know is how to figure the incremental amounts added/subtracted to the original point to move the object to the end point. Unless my end point is and equal distance from my start x AND y, I can't just increment through the distance.
What I'm looking for is a smooth transition from point a to point b. I just don't know what to add/subtract in my loop to get it.
Thanks in advance for any help you can give.