Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tawanda-profuse/c25d3d815e267d0ac84c7e86687200c3 to your computer and use it in GitHub Desktop.
Save tawanda-profuse/c25d3d815e267d0ac84c7e86687200c3 to your computer and use it in GitHub Desktop.
// Build traps on the path when the hero sees a munchkin!
while(true) {
hero.moveXY(41, 20);
var enemy = hero.findNearestEnemy();
if(enemy) {
// Build a "fire-trap" at the Red X (41, 24)
hero.buildXY("fire-trap", 41, 24);
}
// Add an else below to move back to the clearing
else {
hero.moveXY(19, 19);
}
// Move to the Wooden X (19, 19)
hero.moveXY(19, 19);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment