Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
Last active November 4, 2019 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AJFaraday/1ec7b9413c34cd8cd66d5bf28a9537ef to your computer and use it in GitHub Desktop.
Save AJFaraday/1ec7b9413c34cd8cd66d5bf28a9537ef to your computer and use it in GitHub Desktop.
Orbit it!
if(api.turn() == 0) {
api.towardsX()
} else if (api.turn() == 1) {
api.towardsY()
} else {
var dirs = ['awayX', 'awayY', 'towardsX', 'towardsY']
if (typeof api.dir == 'undefined') {
api.dir = 0;
}
if ((api.turn() + 1) % 2) {
//next dir
api[dirs[api.dir]]();
api.dir += 1;
api.dir = api.dir % 4;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment