Advertisement
DOGGYWOOF

shutdown screen

Jan 27th, 2024 (edited)
5
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. -- Shutdown screen code with epic animation for ComputerCraft
  2.  
  3. -- Function to clear the screen
  4. function clearScreen()
  5. term.clear()
  6. term.setCursorPos(1, 1)
  7. end
  8.  
  9. -- Function to display an epic animation
  10. function displayEpicAnimation()
  11. clearScreen()
  12.  
  13. local width, height = term.getSize()
  14. local message = "Shutting Down"
  15. local messageLength = #message
  16. local padding = math.floor((width - messageLength) / 2)
  17.  
  18. for i = 1, height do
  19. for j = 1, padding do
  20. term.write(" ")
  21. end
  22.  
  23. term.write(message)
  24.  
  25. for j = 1, padding do
  26. term.write(" ")
  27. end
  28.  
  29. sleep(0.1)
  30. clearScreen()
  31. end
  32. end
  33.  
  34. -- Main function to initiate shutdown
  35. function shutdown()
  36. displayEpicAnimation()
  37. os.shutdown()
  38. end
  39.  
  40. -- Call the shutdown function
  41. shutdown()
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement