Calculate the angle

Blitz3D Forums/Blitz3D Programming/Calculate the angle

I have a little problem (more of a math than a programming problem :-).

I draw a line using the following code:

Line 320,240,MouseX(),MouseY()


Now I want to calculate the angle of the line, for example if my Mouse Coordinates are (320,100) it should return 0°, if they are (500,240) it should return 90° and so on...

I'm sure someone can help me... ;)

You would use Atan2():
angle#=Atan2(Mousey()-240,MouseX()-320)

Try switching the variables if you don't get the right angles.

Thank you,

works fine :-)