Advertisement
voxeltpt

Line

May 11th, 2020
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.41 KB | None | 0 0
  1. local function line(x,y,v,l) --(v-isVertical)(l-len)
  2.   for i=1,l do
  3.     local xof,yof=0,0
  4.     if v then
  5.       yof=(i-1)+0.01
  6.     else
  7.       xof=(i-1)+0.01
  8.     end
  9.     love.graphics.points(x+xof,y+yof)
  10.   end
  11. end
  12.  
  13. OR
  14. (better ad faster)
  15.  
  16. local function line(x,y,v,l,t)
  17.   t=t or 1
  18.   if v then
  19.     love.graphics.rectangle('fill',x,y,t,l)
  20.   else
  21.     love.graphics.rectangle('fill',x,y,l,t)
  22.   end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement