Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Need help with "Sarven shepherd"


i need help with the “find array” portion of the level. i don’t completely understand and im hoping someone who understands it better can explain it to me. thanks


What it means when it says to wrap it in a while loop is to put the code which you have below that inside a simple:

while(#your code for a while loop, if your having trouble with this look at previous levels which use them) {
    # your code. ...

Sorry if this wasn’t very clear but I just don’t want to give it away.
:lion: :lion: :lion:


ok thanks. ill try it. my problem is that its in a while loop in my current version of the code but all he does is go to the center and stay there, not seeing the enemies.


here is my current code as of 12:30 in centeral U.s time

while(true) {
var enemies = hero.findEnemies();
var enemyIndex = 0;

while (enemyIndex > enemies.length) {

var enemy = enemies[enemyIndex];

if (enemy.type != "sand-yak") {
    while ( > 0){


hero.moveXY(40, 33);



The problem I saw in your screenshot is that the second while true loop needs to be inside the first one (indented four spaces).
I can’t see whether the problem is the same with your most recent post because only half of it is formatted. Please format all your code.
:lion: :lion: :lion:

while (enemyIndex > enemies.length) { //  '>' or '<' ?
     // you are attacking only the first enemy = enemies[0]
     // need to increment enemyIndex to iterate through  the enemies array