Last active
November 4, 2019 12:57
-
-
Save AJFaraday/1ec7b9413c34cd8cd66d5bf28a9537ef to your computer and use it in GitHub Desktop.
Orbit it!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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