yeeeeeeeeeeeee

Untitled

Nov 5th, 2025
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. local mon = peripheral.find("monitor")
  2. if not mon then
  3. print("No monitor found!")
  4. return
  5. end
  6.  
  7. mon.setTextScale(0.5)
  8. mon.setBackgroundColor(colors.white)
  9. mon.clear()
  10.  
  11. local w, h = mon.getSize()
  12. local tiles = {}
  13.  
  14. local function initTiles()
  15. for y = 1, h do
  16. tiles[y] = {}
  17. for x = 1, w do
  18. tiles[y][x] = false
  19. end
  20. end
  21. end
  22.  
  23. local function drawTiles()
  24. for y = 1, h do
  25. mon.setCursorPos(1, y)
  26. for x = 1, w do
  27. if tiles[y][x] then
  28. mon.setBackgroundColor(colors.gray)
  29. else
  30. mon.setBackgroundColor(colors.lightGray)
  31. end
  32. mon.write(" ")
  33. end
  34. end
  35. end
  36.  
  37. local function carveWave()
  38. local col = math.random(1, w)
  39. for row = 1, h do
  40. tiles[row][col] = true
  41. local r = math.random(3)
  42. if r == 1 and col > 1 then
  43. col = col - 1
  44. elseif r == 3 and col < w then
  45. col = col + 1
  46. end
  47. end
  48. end
  49.  
  50. local function fadeTiles()
  51. for y = 1, h do
  52. for x = 1, w do
  53. if math.random(100) < 2 then
  54. tiles[y][x] = false
  55. end
  56. end
  57. end
  58. end
  59.  
  60. initTiles()
  61.  
  62. while true do
  63. carveWave()
  64. fadeTiles()
  65. drawTiles()
  66. sleep(0.05)
  67. end
  68.  
Advertisement
Add Comment
Please, Sign In to add comment