Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function goto(tx, tz, tdir)
- dx = x - tx
- dz = z - tz
- if dz > 0 then
- while z > tz do
- while dir != 1 do
- turnLeft()
- end
- forward()
- end
- elseif dz < 0 then
- while z < tz do
- while dir != 3 do
- turnLeft()
- end
- forward()
- end
- if dx > 0 then
- while dir != 2 do
- turnLeft()
- end
- while x > tx do
- forward()
- end
- elseif dx < 0 then
- while dir != 0 do
- turnLeft()
- end
- while dir != tdir do
- turnLeft()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement