Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.find("monitor")
- term.redirect(monitor)
- local max_x, max_y = term.getSize()
- local dvd = {}
- dvd.x = max_x/2
- dvd.y = max_y/2
- dvd.direction_x = 1
- dvd.direction_y = 1
- color = {
- colors.white,
- colors.orange,
- colors.magenta,
- colors.lightBlue,
- colors.yellow,
- colors.lime,
- colors.pink,
- colors.gray,
- colors.lightGray,
- colors.cyan,
- colors.purple,
- colors.blue,
- colors.brown,
- colors.green,
- colors.red
- }
- local t = 1
- local function reset()
- term.setCursorPos(1,1)
- term.clear()
- paintutils.drawFilledBox(1,1,max_x,max_y,colors.black)
- term.setBackgroundColor(colors.black)
- end
- local function update()
- reset()
- local addx = (dvd.x + dvd.direction_x)
- local addy = (dvd.y + dvd.direction_y)
- if addx >= max_x or addx <= 1 then
- dvd.direction_x = -dvd.direction_x
- t = t + 1
- end
- if addy >= max_y or addy <= 2 then
- dvd.direction_y = -dvd.direction_y
- t = t + 1
- end
- dvd.x = addx
- dvd.y = addy
- paintutils.drawPixel(dvd.x,dvd.y, color[t])
- end
- while true do
- update()
- os.sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement