Taunting Javascript Help [Solved]

// Attack munchkins, call brawlers and ignore burls.
// This function defines the hero's behaviour about enemies.
function dealEnemy(enemy) {
    // If enemy.type is "munchkin":
    if (enemy.type == "munchkins") {
        hero.attack(enemy);
    }    // Then attack it:
         // If the enemy's type is "brawler":
    else if (enemy.type == "brawler") {
        hero.say("hello");
    }    // Then say something to call the brawler:
}
while (true) {
    var enemy = hero.findNearestEnemy();
    if (enemy) {
        dealEnemy(enemy);
    } else {
        hero.moveXY(30, 34);
    }
}

I seemed to do what the comments say and get no errors but the hero does nothing!
Thanks

I can help you in a second, I just have to load up the level okay?

Ok,

Here is the link.

Change that to munchkin

and then get rid of the else in this

I think that’s it, I dont see any more errors in your code

Congrats on beating the level @sci12! :partying_face:

Thanks @JoPro_8000 and @Falcons118. That was the issue!

Anytime :grin:
glad to help

1 Like

More like thanks @Falcons118 I did not do anything :grin:

3 Likes

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