I have been looking for a while for a working function to get the direction my turtle is facing with no luck. So now I gave up on looking for it and decided to ask it here! Is there any easy code for getting the direction as a number (like in the F3 menu)? I'm still fairly new to this so I would like a bit of an explanation/example on how I would use it combined with my own code. Thank you in advance
0
7 replies to this topic
#1
Posted 06 January 2016 - 09:40 PM
#2
Posted 06 January 2016 - 09:44 PM
There is no function in computercraft that tells a turtle which way it is facing. You can find which way you are facing by setting up a GPS cluster and using gps.locate(), then moving forward and using gps.locate() again. Depending on the variable which changed, and if it incremented or decremented, you can find if you are moving north / south / east / west.
GPS API
GPS Tutorial
GPS API
GPS Tutorial
Example of figuring out which way the turtle is facing
Edited by KingofGamesYami, 06 January 2016 - 09:50 PM.
#3
Posted 06 January 2016 - 09:46 PM
KingofGamesYami, on 06 January 2016 - 09:44 PM, said:
There is no function in computercraft that tells a turtle which way it is facing. You can find which way you are facing by setting up a GPS cluster and using gps.locate(), then moving forward and using gps.locate() again. Depending on the variable which changed, and if it incremented or decremented, you can find if you are moving north / south / east / west.
#4
Posted 06 January 2016 - 09:51 PM
I've edited my above post to add a bit more information.
#7
Posted 07 January 2016 - 03:33 PM
Bomb Bloke, on 06 January 2016 - 11:25 PM, said:
Alternatively, Lion4ever came up with a clever solution here.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users