Pr0gramer icon

Prueba1

Pr0gramer | PRO | 10/23/14 02:13:06 AM UTC | 0 ⭐ | 383 👁️ | Never ⏰ | []
Lua |

1.1 KB

|

None

|

0 👍

/

0 👎

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

Comments