Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bubbles = {}
- local bubbleChars = { "0", "O", "o", ",", "*" }
- local x, y = term.getSize()
- term.setTextColor( colors.lightBlue )
- pRunning = true
- local rise = {
- ["0"] = 3,
- O = 3,
- o = 2,
- [","] = 1,
- ["*"] = 1,
- ["."] = 1,
- }
- for i = 1, x, 3 do
- bubbles[ #bubbles + 1 ] = { c = bubbleChars[ math.random( 1, #bubbleChars ) ], x = i + math.random( 0, 2 ), y = y - math.random( 0, 3 ), ly = 1}
- end
- function BubblesMain()
- while pRunning == true do
- for _, bubble in ipairs( bubbles ) do
- if bubble.y < 1 then
- bubble.y = y
- bubble.c = bubbleChars[ math.random( 1, #bubbleChars ) ]
- bubble.lx = bubble.x
- bubble.x = bubble.x + math.random( -1, 1 )
- end
- term.setCursorPos( bubble.lx or bubble.x, bubble.ly )
- term.write( ' ' )
- term.setCursorPos( bubble.x, bubble.y )
- term.write( bubble.c )
- bubble.ly = bubble.y
- local doesRise = math.random( 0, rise[ bubble.c ] ) > 0
- bubble.y = bubble.y - (doesRise and 1 or 0)
- bubble.lx = nil
- end
- sleep( 0.05 )
- end
- end
- parallel.waitForAny(BubblesMain, function()
- os.pullEvent("key")
- pRunning = false
- end)
- term.setCursorPos(1,1)
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement