I'm writing the line algorithm as described in this article:
http://www.gamedev.net/reference/articles/article767.asp
The line only seems to work from within a 45 degree range rather than from any angle. Just can't see why.
repeat
cls
if mouseclick() = 1 and flag = 0
flag = 1
x1 = mousex()
y1 = mousey()
endif
if mouseclick() = 1 and flag = 1
x2 = mousex()
y2 = mousey()
endif
if mouseclick() = 0 then flag = 0
bLine(x1,y1,x2,y2)
`line x1,y1,x2,y2
until spacekey()
function bLine(x1,y1,x2,y2)
x = x1
y = y1
deltax = x2 - x1
deltay = y2 - y1
d = (2 * deltay) - deltax
d1 = 2*deltay
d2 = 2*(deltay-deltax)
for t = x1 to x2
dot x,y
if d < 0
d = d + d1
else
d = d + d2
y = y+1
endif
x = x + 1
next t
endfunction
"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike