Skip to content
Filippo edited this page Feb 2, 2017 · 13 revisions

##line line x0 y0 x1 y1 color

##Parameters: x0 : the x coordinate where the line start
y0 : the y coordinate where the line start
x1 : the x coordinate where the line end
y1 : the y coordinate where the line end
color: the index of the desired color in the current palette

##Description: It draw a straight colored line from (x0,y0) point to (x1,y1) point.

##Example with only and only lines: (and very little math)

-- line demo
pi8=math.pi/8
pi2=math.pi*2

t=0
function TIC()
 cls()

 --lines
 for i=t%8,135,8 do
  line(i,0,0,135-i,8)
  line(i,135,135,135-i,6)
  t=t+0.01
 end

 --prism
 for i=t/16%pi8,pi2,pi8 do
  x=68+32*math.cos(i)
  y=68+32*math.cos(i)
  line(135,0,x,y,15)
  line(0,135,x,y,15)
 end

 --Border
 line(0,0,135,0,8)
 line(0,0,0,135,8)
 line(135,0,135,135,6)
 line(0,135,135,135,6)

end
Clone this wiki locally