loepie

Untitled

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