Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mon = peripheral.wrap("back")
- mon.setCursorBlink(false)
- local stars = {}
- local w,h = mon.getSize()
- -- local i = 1 -- I replaced many of your loops with for loops; seemed simpler.
- for i=1, 21 do
- stars[i] = {math.floor((math.random()-0.5)*200), math.floor((math.random()-0.5)*200), math.floor(math.random()*1000)}
- end
- local function displayStars()
- for i=1, 21 do
- mon.setCursorPos(stars[i][1]/stars[i][3] + w/2, stars[i][2]/stars[i][3] + h/2)
- term.write(mon.getCursorPos()[1] .. mon.getCursorPos()[2])
- mon.write("*")
- end
- end
- local function updateStars()
- for i=1, 21 do
- if stars[i][3]<2 then
- stars[i][3] = stars[i][3] - 1
- else
- stars[i][3] = 1000
- end
- end
- end
- local run = true
- while run do
- if true then
- updateStars()
- mon.clear()
- displayStars()
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement