Advertisement
sanderronde

moving_dashes.lua

Jan 29th, 2019
575
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. -- local function do_write(p, x)
  2. --  p.setTextScale(5);
  3.    
  4. --  p.clear()
  5. --  for h = 1, 8 do
  6. --      for w = 1, 12 do
  7. --          if (h + w) % 2 == x then
  8. --              p.setCursorPos(w, h);
  9. --              p.write('/')
  10. --          end
  11. --      end
  12. --  end
  13. -- end
  14.  
  15. local function do_write(p, x)
  16.     p.setTextScale(1);
  17.    
  18.     p.clear()
  19.     for h = 1, 40 do
  20.         for w = 1, 61 do
  21.             if w % 3 == x then
  22.                 p.setCursorPos(w, h);
  23.                 p.write('|')
  24.             end
  25.         end
  26.     end
  27. end
  28.  
  29. local function main()
  30.     local p = peripheral.wrap("bottom")
  31.  
  32.     while true do
  33.         do_write(p, 0)
  34.         sleep(0.1)
  35.  
  36.         do_write(p, 1)
  37.         sleep(0.1)
  38.  
  39.         do_write(p, 2)
  40.         sleep(0.1)
  41.     end
  42. end
  43.  
  44. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement