serafim7

скринсейвер digitalrain [OpenComputers]

Nov 8th, 2020 (edited)
1,918
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. local gpu = require('component').gpu
  2.  
  3. local unicode = require('unicode')
  4.  
  5. local abc = 'ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゙゚'
  6.  
  7. local tSize = {gpu.getResolution()}
  8.  
  9. local tPos = {}
  10.  
  11. gpu.fill(1, 1, tSize[1], tSize[2], ' ')
  12.  
  13. local function create()
  14.   z = math.random(1, #abc)
  15.   return unicode.sub(abc, z, z)
  16. end
  17.  
  18. local function line(x, y)
  19.   z = math.random(1, 30)
  20.   gpu.set(x, y-z, ' ')
  21.   gpu.setForeground(0x00FF00)
  22.   gpu.set(x, y, create())
  23.   gpu.setForeground(0x008800)
  24.   gpu.set(x, y-1, create())
  25.   os.sleep()
  26. end
  27.  
  28. while true do
  29.   for i = 1, 6 do
  30.     tPos[i] = math.random(1, tSize[1])
  31.   end
  32.   for j = 1, tSize[2]+8 do
  33.     for k = 1, #tPos do
  34.       line(tPos[k], j+k)
  35.     end
  36.   end
  37.   shift = math.random(1, tSize[1])
  38.   gpu.set(shift, 1, ' ')
  39.   gpu.copy(shift, 0, 1, tSize[1], 0, 1)
  40. end
Add Comment
Please, Sign In to add comment