Advertisement
Agent_Silence

Merry Christmas

Dec 16th, 2015
2,066
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.12 KB | None | 0 0
  1. local flakes = {}
  2. local deletedFlakes = {}
  3. local maxX,maxY = term.getSize()
  4. local tColors = {colors.white,colors.lightBlue,colors.lightGray}
  5. local textStage = 1
  6. term.setBackgroundColor(colors.black)
  7. term.clear()
  8. function redraw()
  9.     for i,v in pairs(flakes) do
  10.         if v.stage == 1 then
  11.             if v.y < maxY then
  12.                 paintutils.drawPixel(v.x,v.y,colors.black)
  13.                 v.y = v.y + 1
  14.                 term.setCursorPos(v.x-1,v.y)
  15.                 term.setTextColor(v.color)
  16.                 term.write("*")
  17.                 v.stage = 2
  18.             else
  19.                 table.insert(deletedFlakes, i)
  20.             end
  21.         elseif v.stage == 2 then
  22.             if v.y < maxY then
  23.                 paintutils.drawPixel(v.x-1,v.y,colors.black)
  24.                 v.y = v.y + 1
  25.                 term.setCursorPos(v.x,v.y)
  26.                 term.setTextColor(v.color)
  27.                 term.write("*")
  28.                 v.stage = 3
  29.             else
  30.                 table.insert(deletedFlakes, i)
  31.             end
  32.         elseif v.stage == 3 then
  33.             if v.y < maxY then
  34.                 paintutils.drawPixel(v.x,v.y,colors.black)
  35.                 v.y = v.y + 1
  36.                 term.setCursorPos(v.x+1,v.y)
  37.                 term.setTextColor(v.color)
  38.                 term.write("*")
  39.                 v.stage = 4
  40.             else
  41.                 table.insert(deletedFlakes, i)
  42.             end
  43.         elseif v.stage == 4 then
  44.             if v.y < maxY then
  45.                 paintutils.drawPixel(v.x+1,v.y,colors.black)
  46.                 v.y = v.y + 1
  47.                 term.setCursorPos(v.x,v.y)
  48.                 term.setTextColor(v.color)
  49.                 term.write("*")
  50.                 v.stage = 5
  51.             else
  52.                 table.insert(deletedFlakes, i)
  53.             end
  54.         elseif v.stage == 5 then
  55.             if v.y < maxY then
  56.                 paintutils.drawPixel(v.x,v.y,colors.black)
  57.                 v.y = v.y + 1
  58.                 term.setCursorPos(v.x-1,v.y)
  59.                 term.setTextColor(v.color)
  60.                 term.write("*")
  61.                 v.stage = 2
  62.             else
  63.                 table.insert(deletedFlakes, i)
  64.             end
  65.         end
  66.     end
  67.     if textStage == 1 then
  68.         term.setCursorPos(2,2)
  69.         term.setTextColor(colors.green)
  70.         term.write("M")
  71.         term.setCursorPos(3,2)
  72.         term.setTextColor(colors.red)
  73.         term.write("e")
  74.         term.setCursorPos(4,2)
  75.         term.setTextColor(colors.green)
  76.         term.write("r")
  77.         term.setCursorPos(5,2)
  78.         term.setTextColor(colors.red)
  79.         term.write("r")
  80.         term.setCursorPos(6,2)
  81.         term.setTextColor(colors.green)
  82.         term.write("y")
  83.         term.setCursorPos(8,2)
  84.         term.setTextColor(colors.red)
  85.         term.write("C")
  86.         term.setCursorPos(9,2)
  87.         term.setTextColor(colors.green)
  88.         term.write("h")
  89.         term.setCursorPos(10,2)
  90.         term.setTextColor(colors.red)
  91.         term.write("r")
  92.         term.setCursorPos(11,2)
  93.         term.setTextColor(colors.green)
  94.         term.write("i")
  95.         term.setCursorPos(12,2)
  96.         term.setTextColor(colors.red)
  97.         term.write("s")
  98.         term.setCursorPos(13,2)
  99.         term.setTextColor(colors.green)
  100.         term.write("t")
  101.         term.setCursorPos(14,2)
  102.         term.setTextColor(colors.red)
  103.         term.write("m")
  104.         term.setCursorPos(15,2)
  105.         term.setTextColor(colors.green)
  106.         term.write("a")
  107.         term.setCursorPos(16,2)
  108.         term.setTextColor(colors.red)
  109.         term.write("s")
  110.         textStage = 2
  111.     elseif textStage == 2 then
  112.         term.setCursorPos(2,2)
  113.         term.setTextColor(colors.red)
  114.         term.write("M")
  115.         term.setCursorPos(3,2)
  116.         term.setTextColor(colors.green)
  117.         term.write("e")
  118.         term.setCursorPos(4,2)
  119.         term.setTextColor(colors.red)
  120.         term.write("r")
  121.         term.setCursorPos(5,2)
  122.         term.setTextColor(colors.green)
  123.         term.write("r")
  124.         term.setCursorPos(6,2)
  125.         term.setTextColor(colors.red)
  126.         term.write("y")
  127.         term.setCursorPos(8,2)
  128.         term.setTextColor(colors.green)
  129.         term.write("C")
  130.         term.setCursorPos(9,2)
  131.         term.setTextColor(colors.red)
  132.         term.write("h")
  133.         term.setCursorPos(10,2)
  134.         term.setTextColor(colors.green)
  135.         term.write("r")
  136.         term.setCursorPos(11,2)
  137.         term.setTextColor(colors.red)
  138.         term.write("i")
  139.         term.setCursorPos(12,2)
  140.         term.setTextColor(colors.green)
  141.         term.write("s")
  142.         term.setCursorPos(13,2)
  143.         term.setTextColor(colors.red)
  144.         term.write("t")
  145.         term.setCursorPos(14,2)
  146.         term.setTextColor(colors.green)
  147.         term.write("m")
  148.         term.setCursorPos(15,2)
  149.         term.setTextColor(colors.red)
  150.         term.write("a")
  151.         term.setCursorPos(16,2)
  152.         term.setTextColor(colors.green)
  153.         term.write("s")
  154.         textStage = 1
  155.     end
  156.     for i,v in pairs(deletedFlakes) do
  157.         table.remove(flakes,v)
  158.     end
  159.     deletedFlakes = {}
  160. end    
  161.  
  162. function newflake()
  163.     local template = {
  164.         x = 1,
  165.         y = 0,
  166.         color = colors.white,
  167.         stage = 2}
  168.     template.x = math.random(1,maxX)
  169.     template.color = tColors[math.random(1,3)]
  170.     table.insert(flakes,template)
  171. end
  172.  
  173. while true do
  174. newflake()
  175. redraw()
  176. sleep(0.2)
  177. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement