Java script "taunting"

I can’t pass this level. please check and correct code. give me nice advice.

here is my coding
// 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 == “munchkin”) {
// Then attack it:
hero.attack(enemy);
}
// If the enemy’s type is “brawler”:
else if (enemy.type == “brawler”) {
hero.moveXY(30, 34);
// Then say something to call the brawler:
hero.say(“hey! come on silly brawler!”);
}
while (true) {
if (enemy) {
dealEnemy(enemy);
} else {
hero.moveXY(30, 34);
}
}
}


1 Like

Please format your code correctly using the </> button above your writing space

1 Like

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

2 Likes

Heres a hint, the hero says “i don’t think its a good idea”.Is that taunting him?

1 Like

okay. I’ll change the word. any other wrong thing? tell me honestly. because hero does not attack to enemy after run…

The code is already formatted correctly

Anyways welcome to the forum @Ai_Yoshioka. I’m going to leave this level to the others but make sure to read the rules and we hope you enjoy it here!

With that being said could you send a sc of ur code?

1 Like

It was edited

Also enemy is not defined try “munckin”.

Change that statement to just an if statement. Then delete that moveXY statement.

1 Like

he already changed that

okay i will. i need put spoiler tag for this post… sorry I didn’t know rule details.

Can you show us your code now?

Its ok we all understand :slight_smile:

I have changed character and language. thank god finally I passed taunting level. thank you for helped me guys!

1 Like

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