loepie

Untitled

May 11th, 2013
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. term.clear()
  2.  
  3. dn = colors.lime
  4. de = colors.purple
  5. ds = colors.orange
  6. dw = colors.lightBlue
  7. rs = redstone
  8.  
  9. function moveNorth()
  10.     rs.setBundledOutput("left", dn)
  11.     sleep(0.7)
  12.     rs.setBundledOutput("left", 0)
  13.     sleep(0.7)
  14. end
  15.  
  16. function moveEast()
  17.     rs.setBundledOutput("left", de)
  18.     sleep(0.7)
  19.     rs.setBundledOutput("left", 0)
  20.     sleep(0.7)
  21. end
  22.  
  23. function moveSouth()
  24.     rs.setBundledOutput("left", ds)
  25.     sleep(0.7)
  26.     rs.setBundledOutput("left", 0)
  27.     sleep(0.7)
  28. end
  29.  
  30. function moveWest()
  31.     rs.setBundledOutput("left", dw)
  32.     sleep(0.7)
  33.     rs.setBundledOutput("left", 0)
  34.     sleep(0.7)
  35. end
  36.  
  37. function movement()
  38.     while true do
  39.         print("What direction do you want to move?")
  40.         print("Use (n) for North")
  41.         print("Use (e) for East")
  42.         print("Use (s) for South")
  43.         print("Use (w) for West")
  44.         print("Use (q) to Exit")
  45.  
  46.         direction = io.read()
  47.         if direction == "n" then
  48.             moveNorth()
  49.             moveNorth()
  50.         else
  51.             if direction == "e" then
  52.                 moveEast()
  53.                 moveEast()
  54.             else
  55.                 if direction == "s" then
  56.                     moveSouth()
  57.                     moveSouth()
  58.                 else
  59.                     if direction == "w" then
  60.                         moveWest()
  61.                         moveWest()
  62.                     else
  63.                         if direction == "q" then
  64.                             break
  65.                         else
  66.                             print("Wrong choice")
  67.                         end
  68.                     end
  69.                 end
  70.             end    
  71.         end
  72.     end
  73. end
  74. movement()
Advertisement
Add Comment
Please, Sign In to add comment