Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local x1 = 1
- local x2 = 51
- local y1 = 1
- local y2 = 19
- local xStep = 1
- local yStep = 1
- local charList = {"|", "/", "-", "\\"}
- local function ripple(rand)
- local index = 1
- while true do
- local rTimer = os.startTimer(.05)
- local events = {os.pullEvent()}
- if events[1] == "timer" then
- for w = x1, x2, xStep do
- index = rand and math.random(1, #charList) or (index + 1)
- if index > #charList and not rand then index = 1 end
- term.setBackgroundColor(2 ^ math.random(0, 15))
- for h = y1, y2, yStep do
- term.setCursorPos(w, h)
- write(charList[index])
- end
- end
- elseif events[1] == "mouse_click" or events[1] == "mouse_drag" then
- if events[2] == 1 then
- x1 = events[3]
- y1 = events[4]
- elseif events[2] == 2 then
- x2 = events[3]
- y2 = events[4]
- end
- term.setBackgroundColor(colors.black)
- term.clear()
- end
- if x1 > x2 then xStep = -1 else xStep = 1 end
- if y1 > y2 then yStep = -1 else yStep = 1 end
- end
- end
- ripple(false)
Advertisement
Add Comment
Please, Sign In to add comment