I have in other threads posted problems and have received a great deal of help and good feed back from the old timers here. I want to thank you all for that and I have just one remaining issue.

I was working on translating and old QBasic program to Java I finally got my code to compile AND run. I then went back to the original QB code for comparison trying to get the vector math to work correctly because it did not work as expected. I did notice some typos in my java algorithms, and now the math looks exactly the way it did in the QB code, but the output still does not look right.

My question is, is java math the same as QB math? namley, does java.sqrt() work out the square root the same way that sqrt() did in QB?

here is the math:

I need to move an object(star) at x,y on a line from the center of the screen to the edge of the screen. To do this my data uses a 0,0 @ center grid.

So to get the angle I do:

angle = java.sqrt((x1*x1)+(y1*y1))

This is the same as:

angle = java.hypot(x1,y1)

the new position is relative to the old one, so:

x2 = x1 / angle

y2 = y1 / angle

since this new position is relative, I have to add it to the old position to get the real new position, so:

x1 = x1 + x2

y1 = y1 + y2

Then I translate it all to a 0,0 @ top left grid by adding half the grid width to both x and y (newX = x + (width / 2)) only when I need to draw the star.

This works real perfect in QBasic but the stars do not move correctly in java. If someone here knows vector math, I would really like some help. I did not post the code because the code works fine. I will continue to look for errors in my vector math, but if java does not calculate things in the same order as other languages or something else equally as silly please let me know.