Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("top")
- mon.setTextScale(3)
- term.redirect(mon)
- local xSize, ySize = term.getSize()
- local xPos, yPos, xLen, yLen = math.random(xSize-5), math.random(ySize-5), math.random(5), math.random(5)
- local xDir, yDir, xLenDir, yLenDir = 1, 1, 1, 1
- local smallWindow = window.create(term.current(), xPos, yPos, xLen, yLen)
- smallWindow.setBackgroundColor(colours.white)
- while true do
- sleep(0.2)
- xPos = xPos + xDir
- yPos = yPos + yDir
- xLen = xLen + xLenDir
- yLen = yLen + yLenDir
- term.setBackgroundColor(colours.black)
- term.clear()
- smallWindow.reposition(xPos, yPos, xLen, yLen)
- smallWindow.clear()
- if xPos <= 1 then xDir = 1 end
- if xPos + xLen >= xSize + 1 then xDir = -1 end
- if yPos <= 1 then yDir = 1 end
- if yPos + yLen >= ySize + 1 then yDir = -1 end
- if xLen <= 1 then xLenDir = 1 end
- if xLen >= 5 then xLenDir = -1 end
- if yLen <= 1 then yLenDir = 1 end
- if yLen >= 5 then yLenDir = -1 end
- end
Advertisement
Add Comment
Please, Sign In to add comment