Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("back")
- m.setTextScale(0.5)
- x,y = m.getSize()
- print(x..":"..y)
- iter = 0
- text = {}
- items = {}
- stars = {}
- starsNbr = 200
- function registerStars()
- stars = {}
- for i=1,starsNbr do
- toAdd = {}
- toAdd["x"] = math.random(1,x)
- toAdd["y"] = math.random(1,y)
- table.insert(stars,toAdd)
- end
- end
- function forwardStars()
- for k,v in pairs(stars) do
- stars[k]["x"] = stars[k]["x"]+1
- end
- for i=1,10 do
- toAdd = {}
- toAdd["x"] = 1
- toAdd["y"] = math.random(1,y)
- if math.random(1,100) > 90 then table.insert(stars,toAdd) end
- end
- end
- function drawStars()
- for k,v in pairs(stars) do
- m.setCursorPos(v["x"],v["y"])
- if math.random(1,100) > 70 then m.setTextColor(colors.lightGray) else m.setTextColor(colors.gray) end
- m.write(".")
- end
- end
- function redraw()
- m.clear()
- m.setTextColor(colors.gray)
- drawStars()
- m.setTextColor(colors.green)
- for k,v in ipairs(items) do
- items[k]["x"] = v["x"]+1
- m.setCursorPos(v["x"],v["y"])
- randText = math.random(1,3)
- if randText < 2 then
- text = "Airelad"
- elseif randText > 2 then
- text = "wormboy9000"
- else
- text = "_Mush_"
- end
- m.write(text)
- x,y = m.getSize()
- if v["x"] > x then table.remove(items,k) end
- end
- end
- function addPlot()
- h = math.random(1,y)
- add = {}
- add["x"] = 1
- add["y"] = h
- table.insert(items,add)
- end
- registerStars()
- addPlot()
- while true do
- iter = iter + 1
- redraw()
- os.sleep(0.5)
- if iter % 14 == 0 then addPlot() end
- if iter % 20 == 0 then forwardStars() end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement