Pr0gramer

Prueba1

Oct 22nd, 2014
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. mon = peripheral.wrap("top")
  2. mon.setTextScale(3)
  3. term.redirect(mon)
  4.  
  5. local xSize, ySize = term.getSize()
  6. local xPos, yPos, xLen, yLen = math.random(xSize-5), math.random(ySize-5), math.random(5), math.random(5)
  7. local xDir, yDir, xLenDir, yLenDir = 1, 1, 1, 1
  8.  
  9. local smallWindow = window.create(term.current(), xPos, yPos, xLen, yLen)
  10. smallWindow.setBackgroundColor(colours.white)
  11.  
  12. while true do
  13.         sleep(0.2)
  14.        
  15.         xPos = xPos + xDir
  16.         yPos = yPos + yDir
  17.         xLen = xLen + xLenDir
  18.         yLen = yLen + yLenDir
  19.        
  20.         term.setBackgroundColor(colours.black)
  21.         term.clear()
  22.         smallWindow.reposition(xPos, yPos, xLen, yLen)
  23.         smallWindow.clear()
  24.        
  25.         if xPos <= 1 then xDir = 1 end
  26.         if xPos + xLen >= xSize + 1 then xDir = -1 end
  27.        
  28.         if yPos <= 1 then yDir = 1 end
  29.         if yPos + yLen >= ySize + 1 then yDir = -1 end
  30.        
  31.         if xLen <= 1 then xLenDir = 1 end
  32.         if xLen >= 5 then xLenDir = -1 end
  33.        
  34.         if yLen <= 1 then yLenDir = 1 end
  35.         if yLen >= 5 then yLenDir = -1 end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment