Constant speed, known distance movement
Ok, so I have an image that needs to move from point A(entryX,entryY) to point B(destinationX, destinationY).
There are different images moving at the same time, all headed for the same point B. Each have their own random point A.
Their co-ordinates are updated every 100ms by doing myX+=travelX and myY+=travelY
Using the code below that someone helped me with the images do travel to point B but their speed is different depending on their start location - if they are basically head on (i.e. point A x is almost the same as point B x) then the speed is very fast. If there is large difference in x, then speed is slow.
How do I make it so speed will be constant no matter where the start point (Point A) is?
myX = entryX;
myY = entryY;
destinationX = 300;
destinationY = 300;
xDistance = entryX-destinationX;
yDistance = entryY-destinationY;
double yD2 = yDistance * yDistance;
double xD2 = xDistance * xDistance;
travelX = Math.sqrt( (xD2 + yD2) / yD2 );
travelY = Math.sqrt( (xD2 + yD2) / xD2 );

