Advertisement
loepie

Untitled

May 11th, 2013
24
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.     movement()
  15. end
  16.  
  17. function moveEast()
  18.     rs.setBundledOutput("left", de)
  19.     sleep(0.7)
  20.     rs.setBundledOutput("left", 0)
  21.     sleep(0.7)
  22.     movement()
  23. end
  24.  
  25. function moveSouth()
  26.     rs.setBundledOutput("left", ds)
  27.     sleep(0.7)
  28.     rs.setBundledOutput("left", 0)
  29.     sleep(0.7)
  30.     movement()
  31. end
  32.  
  33. function moveWest()
  34.     rs.setBundledOutput("left", dw)
  35.     sleep(0.7)
  36.     rs.setBundledOutput("left", 0)
  37.     sleep(0.7)
  38.     movement()
  39. end
  40.  
  41. function movement()
  42.     while true do
  43.         print("What direction do you want to move?")
  44.         print("Use (n) for North")
  45.         print("Use (e) for East")
  46.         print("Use (s) for South")
  47.         print("Use (w) for West")
  48.         print("Use (q) to Exit")
  49.  
  50.         direction = io.read()
  51.         if direction == "n" then
  52.             moveNorth()
  53.             moveNorth()
  54.         else
  55.             if direction == "e" then
  56.                 moveEast()
  57.                 moveEast()
  58.             else
  59.                 if direction == "s" then
  60.                     moveSouth()
  61.                     moveSouth()
  62.                 else
  63.                     if direction == "w" then
  64.                         moveWest()
  65.                         moveWest()
  66.                     else
  67.                         if direction == "q" then
  68.                             break
  69.                         else
  70.                             print("Wrong choice")
  71.                         end
  72.                     end
  73.                 end
  74.             end    
  75.         end
  76.     end
  77. end
  78. movement()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement