Created
April 23, 2014 02:20
-
-
Save Fortyseven/11200844 to your computer and use it in GitHub Desktop.
Code that got me through Level 11 and 12 of Untrusted
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
var player = map.getPlayer(); | |
if (this.init === undefined) { | |
this.player_last_x = player.getX(); | |
this.player_last_y = player.getY(); | |
this.init = true; | |
return; | |
} | |
if (player.getX() > this.player_last_x) me.move('right'); | |
if (player.getX() < this.player_last_x) me.move('left'); | |
if (player.getY() > this.player_last_y) me.move('down'); | |
if (player.getY() < this.player_last_y) me.move('up'); | |
this.player_last_x = player.getX(); | |
this.player_last_y = player.getY(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment