I've seen this asked a few times, I think I've wanted to know myself before as well. It wasn't until I saw the equation to find the dot product that I realized how easy it was to figure out.
|A| * |B| * cos(a)
The lengths of vectors A and B multiplied together along with the cosine of the angle between them equals the dot product. But the simpler way to calculate the dot product is:
A.x * B.x + A.y * B.y
Put two and two together and I get the method shown below. Here's a quick demo. Use the mouse buttons to change the vectors.
n = make vector2(1)
set vector2 1, 50, 13
Alen# = length vector2(1)
n = make vector2(2)
set vector2 2, 27, -40
Blen# = length vector2(2)
dp# = dot product vector2(1, 2)
REPEAT
cls
if mouseclick() = 1
set vector2 1, mousex()-320, mousey()-240
Alen# = length vector2(1)
dp# = dot product vector2(1, 2)
endif
if mouseclick() = 2
set vector2 2, mousex()-320, mousey()-240
Blen# = length vector2(2)
dp# = dot product vector2(1, 2)
endif
a# = acos(dp# / (Alen#*Blen#))
print "Angle: ", a#
ink rgb(255,0,0),0
line 320, 240, 320+x vector2(1), 240+y vector2(1)
text 320+x vector2(1), 240+y vector2(1), "A"
ink rgb(0,255,0),0
line 320, 240, 320+x vector2(2), 240+y vector2(2)
text 320+x vector2(2), 240+y vector2(2), "B"
UNTIL spacekey()
end