[SOLVED] Endangered Burl, Javascript

My level is in the third world and its level 12.
The error is that as soon as the “ogre” comes the hero does not move and he/she would die.

// Only attack enemies of type "munchkin" and "thrower".
// Don't attack a "burl". Run away from an "ogre"!
while(true) {
    var enemy = hero.findNearestEnemy();
    
    // Remember: don't attack type "burl"!
    if (enemy.type == "burl") {
        hero.say("I'm not attacking that Burl!");
    }
    
    // The "type" property tells you what kind of creature it is.
    if (enemy.type == "munchkin") {
        hero.attack(enemy);
    }
    
    // Use "if" to attack a "thrower".
    if (enemy.type == "thrower") {
        hero.attack(enemy) ;
    }
    }
    // If it's an "ogre", use moveXY to run away to the village gate!
    if (enemy.type == "ogre") {
         hero.moveXY(22, 47) ;
   }

your if is outside the while loop

ah teehee thats my bad, thank you

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.