bearings

BlitzMax Forums/BlitzMax Beginners Area/bearings

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

this might be what you need:

blitzmax angles are -180 to 180 (360 degrees)


EDIT:
Strict

Graphics 800,600
Local midx:Int = GraphicsWidth()/2
Local midy:Int = GraphicsHeight()/2
Local mx:Int
Local my:Int

Repeat
		
	mx = MouseX()
	my = MouseY()
	
	DrawLine (midx,midy,mx,my)
	
	Local myangle = ANGLE(mx,my,midx,midy)
	
	DrawText "B",mx+16,my
	DrawText "angle="+myangle,mx+20,my+20
	
	
	
	SetRotation myangle
		DrawText "A",midx,midy
	SetRotation 0	
	Flip ; Cls 

Until KeyDown(KEY_ESCAPE)

 Function ANGLE:Float(x1,y1,x2,y2)
		Local angle = ATan2(x2-x1,y1-y2)+180 ' Thanks Skidracer
		' Inverse Tangent
	Return angle
End Function