Guest User

Bridge

a guest
Jan 2nd, 2013
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. --3 wide Bridge by SparkVGX
  2.  
  3. --Var
  4. continue = true
  5. lane = 1
  6. distance = 0
  7. tLeft = false
  8.  
  9. --Place down
  10. func pDown()
  11.   if turtle.detectDown() == false then
  12.    if turtle.placeDown() == false then
  13.      print("Need blocks")
  14.      sleep(5)
  15.      pDown()
  16.    end
  17.   end    
  18. end
  19.  
  20. func turn()
  21.   if tLeft then
  22.     turtle.turnLeft()
  23.     turtle.forward()
  24.     turtle.turnLeft()
  25.   end
  26.   else
  27.     turtle.turnRight()
  28.     turtle.forward()
  29.     turtle.turnRight()
  30.   end
  31.   tLeft = not tLeft
  32. end
  33.  
  34. func Lane()
  35.   if lane == 1
  36.     while turtle.detect() == false do
  37.       pDown()
  38.       turtle.forward()
  39.       distance = distance + 1
  40.       lane = lane + 1
  41.     end
  42.   end
  43.   else if lane ~= 1
  44.     for i=0,distance
  45.       pDown()
  46.       turtle.forward()
  47.     end
  48.   end    
  49. end
  50.  
  51. func goHome()
  52.   turtle.turnLeft()
  53.   turtle.forward(2)
  54.   turtle.turnLeft()
  55.  
  56.   for i=0,distance do
  57.     turtle.forward()
  58.   end
  59. end
  60.  
  61.  
  62. Lane()
  63. turn()
  64. Lane()
  65. turn()
  66. Lane()    
  67. goHome()
Advertisement
Add Comment
Please, Sign In to add comment