Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. This = {
  2. x = 0,
  3. y = 0,
  4. z = 0,
  5. rotation = 0
  6. }
  7.  
  8. function This.face (self, deg)
  9. if self.rotation == deg then
  10. return true
  11. else
  12. self.rotateRight(self)
  13. self.face(self, deg)
  14. end
  15. end
  16.  
  17. function This.rotateRight (self)
  18. if turtle.turnLeft() == true then
  19. self.rotation = self.rotation - 1
  20. if self.rotation < 0 then
  21. self.rotation = 3
  22. end
  23. else
  24. return false
  25. end
  26. end
  27.  
  28. function This.rotateRight (self)
  29. if turtle.turnRight() then
  30. self.rotation = self.rotation + 1
  31. if self.rotation > 3 then
  32. self.rotation = 0
  33. end
  34. else
  35. return false
  36. end
  37. end
  38.  
  39. function This.move (self, x, y, z)
  40. return true
  41. end
  42.  
  43. a = This
  44.  
  45. a.face(a, 2)
  46. a.face(a, 1)
  47. a.face(a, 2)
  48. a.face(a, 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement