i am working on that since 4 h … help me i think its a bug ! if not can u do it for me … i just want to go to the next exercice !!
NAME OF EXERCICE : 24.1-bookkeeper
my code :
// Fight enemies for 15 seconds.
// Keep count whenever an enemy is defeated.
var count=0;
while (true) {
enemy=this.findNearest(this.findEnemies());
if (enemy) {this.attack(enemy); count++;}
if(this.now() > 15) break;
}
// Tell Naria how many enemies you defeated.
this.moveXY(58, 33);
this.say(count);
// Collect coins until the clock reaches 30 seconds.
while (true) {
item=this.findNearest(this.findItems());
this.moveXY(item.pos.x, item.pos.y);
if(this.now() > 30) break;
}
// Tell Naria how much gold you collected.
this.moveXY(58, 33);
this.say(this.gold);
// Fight enemies until the clock reaches 45 seconds.
// Remember to reset the count of defeated enemies!
var count1=0;
while (true) {
enemy=this.findNearest(this.findEnemies());
if (enemy) {this.attack(enemy); count1++;}
if(this.now() > 45) break;
}
// Tell Naria how many enemies you defeated.
this.moveXY(58, 33);
this.say(count1);
*** thanks !!!**