andrelisboa1

invaders

May 21st, 2025
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local m = peripheral.find("monitor")
  2. local cBlack = colors.black
  3. local cWhite = colors.white
  4.  
  5. local s = ""
  6.  
  7. function setCharMode(_isWhiteOnBlack)
  8.     if _isWhiteOnBlack then
  9.         m.setTextColor(cWhite)
  10.         m.setBackgroundColor(cBlack)
  11.     else
  12.         m.setTextColor(cBlack)
  13.         m.setBackgroundColor(cWhite)
  14.     end
  15. end
  16.  
  17. function drawSpaceship(_x, _y)
  18.     setCharMode(true)
  19.     m.setCursorPos(_x, _y)
  20.     m.write(string.char(158))
  21.    
  22.     setCharMode(false)
  23.     m.setCursorPos(_x+1, _y)
  24.     m.write(string.char(146))
  25.    
  26.     setCharMode(true)
  27. end
  28.  
  29. function drawAlien(_x, _y)
  30.     setCharMode(true)
  31.     m.setCursorPos(_x, _y)
  32.     m.write(string.char(155))
  33.     setCharMode(false)
  34.     m.setCursorPos(_x+1, _y)
  35.     m.write(string.char(152))
  36.    
  37.     setCharMode(true)
  38. end
  39.  
  40. m.clear()
  41.  
  42. drawSpaceship(13, 11)
  43.  
  44. for i=0, 5 do
  45.     for j=0, 1 do
  46.         drawAlien(2 + i*4, 2 + j*3)
  47.     end
  48. end
  49.  
  50.  
  51.  
Add Comment
Please, Sign In to add comment