Advertisement
Guest User

Untitled

a guest
May 25th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. function goto(tx, tz, tdir)
  2. dx = x - tx
  3. dz = z - tz
  4.  
  5. if dz > 0 then
  6. while z > tz do
  7. while dir != 1 do
  8. turnLeft()
  9. end
  10. forward()
  11. end
  12. elseif dz < 0 then
  13. while z < tz do
  14. while dir != 3 do
  15. turnLeft()
  16. end
  17. forward()
  18. end
  19.  
  20. if dx > 0 then
  21. while dir != 2 do
  22. turnLeft()
  23. end
  24.  
  25. while x > tx do
  26. forward()
  27. end
  28. elseif dx < 0 then
  29. while dir != 0 do
  30. turnLeft()
  31. end
  32.  
  33. while dir != tdir do
  34. turnLeft()
  35. end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement