My Code:
// Fight enemies for 15 seconds.
// Keep count whenever an enemy is defeated.
var defeated = 0;
while (true) {
var enemy = hero.findNearestEnemy();
if (enemy) {
hero.attack(enemy);
if (enemy.health <= 0) {
defeated += 1;
}
}
if (hero.now() > 15) {
break;
}
}
hero.moveXY(59, 33);
hero.say(defeated);
var defeated = 0;
while (true) {
var enemy = hero.findNearestEnemy();
if (enemy) {
hero.attack(enemy);
hero.attack(enemy);
if (enemy.health <= 0) {
defeated += 1;
}
}
if (hero.now() > 50) {
break;
}
}
hero.moveXY(59, 33);
hero.say(defeated);
" Golden " I am writing the code for the report gives an error
Here is the default code:
// Fight enemies for 15 seconds.
// Keep count whenever an enemy is defeated.
var defeated = 0;
while (true) {
var enemy = hero.findNearestEnemy();
if (enemy) {
hero.attack(enemy);
if (enemy.health <= 0) {
defeated += 1;
}
}
if (hero.now() > 15) {
break;
}
}
// Tell Naria how many enemies you defeated.
hero.moveXY(59, 33);
hero.say(defeated);
// Collect coins until the clock reaches 30 seconds.
// Tell Naria how much gold you collected.
// Fight enemies until the clock reaches 45 seconds.
// Remember to reset the count of defeated enemies!
// Tell Naria how many enemies you defeated.
Be very careful about deleting the comments. I believe you missed a step. Also be careful on your timing.