I have tried this level over and over and cannot get past it


#1

// Only attack enemies of type “munchkin” and “thrower”.;
// Don’t attack a “burl”. Run away from an “ogre”!
while (true) {
var enemy = this.findNearestEnemy();

// Remember: don't attack type "burl"!
if (enemy.type == "burl") {
    this.say("I'm not attacking that Burl!");
}
// The "type" property tells you what kind of creature it is.
if (enemy.type == "munchkin") {
}
// Use "if" to attack a "thrower".
if (enemy.type == "thrower") {
 this.attack (enemy);   
         this.moveXY(40, 47); 
}
// If it's an "ogre", use moveXY to run away to the village gate!

}
this.attack (enemy);
if (“ogre”)
this.moveXY(40, 47);


#2

Look at the pattern for how the previous examples were written

if (enemy.type == "burl"){
// take action
}

Can you spot how yours is different? You forgot the enemy.type ==

Also read the directions carefully and make sure you are attacking when asked to attack and running when asked to run.


#3

I already did that but it still didn’t work. I don’t know where to put the move xy to because it ruins the rest of my code.


#4

please look closely and find the difference between:

 this.attack (enemy);
 if ("ogre")
 this.moveXY(40, 47);

and

 if (enemy.type == "thrower") {
  this.attack (enemy);   
          this.moveXY(40, 47); 
 }