Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --m= peripheral.wrap('left')
- --term.redirect(m)
- term.setBackgroundColor(8)
- function addnow(x,y,colorr)
- for i=1,#snow do
- if (snow[i]['x'] == x and snow[i]['y'] == y) then
- return
- end
- end
- snow[#snow+1]= {}
- snow[#snow]['x']= x
- snow[#snow]['y']= 1
- if (colorr == nil) then snow[#snow]['color']= randomColor() else snow[#snow]['color']= colorr end
- end
- function snowupdate()
- for i=#snow,1,-1 do
- if (snow[i]['y'] > Y) then table.remove(snow,i) end
- end
- for i=1,#snow do
- q= math.random(1,5)
- if (q == 3) then snow[i]['y']= snow[i]['y']+1 end
- q= math.random(1,10)
- if (q == 5) then qq= math.random(1,5) if (qq == 3) then snow[i]['x']= snow[i]['x']+1 else snow[i]['x']= snow[i]['x']-1 end end
- q= math.random(1,20)
- if (q == 5) then snow[i]['color']= randomColor() end
- end
- end
- function draw()
- term.clear()
- q= math.random(1,4000)
- if (q == 1) then term.setBackgroundColor(randomColor()) end
- for i=1,#snow do
- term.setCursorPos(snow[i]['x'],snow[i]['y'])
- term.setTextColor(snow[i]['color'])
- write('X')
- end
- end
- function randomColor()
- x= math.random(1,#color)
- return x
- end
- color= {}
- for k,v in pairs(colors) do
- color[#color+1]= v
- end
- snow= {}
- X,Y= term.getSize()
- while true do
- x= math.random(1,X)
- addnow(x,1)
- draw()
- snowupdate()
- sleep(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement