while(true) {
var enemies = hero.findEnemies();
var enemyIndex = 0;
while(enemyIndex < enemies.length) {
var enemy = enemies[enemyIndex];
hero.bash(enemy);
hero.moveXY(40, 33);
enemyIndex ++;
}
}
The thing is that when hero bashes enemy[0], it can’t reach bombs so enemy[0] stays alive, but when hero bashes enemy[1,2,3] it works for them.
So may be there is a bug or something. Can you please help me with that. Thank you.
if (hero.isReady(‘bash’) && hero.isPathClear(hero.pos, enemy.pos))
Before hero.bash(enemy) it’s much safer to check if bash is ready and if path to the enemy is clear. After blowing all fire traps it’s easy to collect the gold.
I still have the same problem - when hero bashes enemy[0], it can’t reach bombs so enemy[0] stays alive, but when hero bashes enemy[1,2,3] it works for them.
HI @dylancrocker, welcome to the CodeCombat Discourse
Thank you for helping, but please could you not post complete solutions as it’s against the purpose of the Discourse and we would prefer for solutions to not be readily available to students who might use them without actually trying to solve the level.
Thanks
Danny