Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Direction = ""
  2. X = 0
  3. Y = 0
  4.  
  5. function TurnLeft()
  6. turtle.turnLeft()
  7. if(Direction == "X") then Direction = "-Y" end
  8. if(Direction == "-X") then Direction = "Y" end
  9. if(Direction == "Y") then Direction = "X" end
  10. if(Direction == "-Y") then Direction = "-X" end
  11. end
  12.  
  13. function TurnRight()
  14. turtle.turnRight()
  15. if(Direction == "X") then Direction = "Y" end
  16. if(Direction == "-X") then Direction = "-Y" end
  17. if(Direction == "Y") then Direction = "-X" end
  18. if(Direction == "-Y") then Direction = "X" end
  19. end
  20.  
  21. function TurnBack()
  22. turtle.turnLeft()
  23. turtle.turnLeft()
  24. if(Direction == "X") then Direction = "-X" end
  25. if(Direction == "-X") then Direction = "X" end
  26. if(Direction == "Y") then Direction = "-Y" end
  27. if(Direction == "-Y") then Direction = "Y" end
  28. end
  29.  
  30. function Forward()
  31. turtle.forward()
  32. if(Direction == "X") then X = X + 1 end
  33. if(Direction == "-X") then X = X - 1 end
  34. if(Direction == "Y") then Y = Y + 1 end
  35. if(Direction == "-Y") then Y = Y - 1 end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement