Advertisement
kreezxil

sine with wake

Aug 21st, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. screen=peripheral.wrap("top")
  2. if not screen then
  3.   screen = term.native()
  4. end
  5.  
  6. local scr_x, scr_y = screen.getSize()
  7.        
  8. local doit = function(move)
  9.   if not move then move = 0 end
  10.   local res1,res2
  11.   for a = 1, scr_y do
  12.     for b = 1, scr_x do
  13.       local x = b+math.floor(scr_x/2)
  14.       local y = a-math.ceil(scr_y/2)
  15.       res1 = math.abs( math.floor(math.sin((x/7)+move)*6) - y ) <= 2
  16.       screen.setCursorPos(b,a)
  17.       if res1 then
  18.         screen.blit(" ","7","7")
  19.       else
  20.         screen.write(" ")
  21.       end
  22.       res2 = math.abs( math.floor(math.cos((x/4)+(move*4))*3) - y+2 ) <= 1
  23.       screen.setCursorPos(b,a)
  24.       if res2 then
  25.         screen.blit(" ","8","8")
  26.       else
  27.         if not res1 then
  28.           if (x % 2 == 0) and ((y+math.floor(move*-10)+(x % 5)) % 5 <= 1) then
  29.             screen.blit("|","7","f")
  30.           else
  31.             screen.write(" ")
  32.           end
  33.         end
  34.       end
  35.     end
  36.   end
  37. end
  38.  
  39. while true do
  40.   for a = 1, 900 do
  41.     --screen.clear()
  42.     doit(a/10)
  43.         event, param = os.pullEvent()
  44.         if event == "char" or
  45.            event == "key" or
  46.            event == "paste" or
  47.            event == "mouse_click" or
  48.            event == "mouse_drag" or
  49.            event == "mouse_up" or
  50.            event == "mouse_scroll" or
  51.              then
  52.          system
  53.     sleep(0.05)
  54.   end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement