Clash of Clones Help!


Hey everyone, I need help with my code in ClashOfClones level. My hero dies too fast. I have tried literally everything: I got the best sword, best shield with bash, then just shield and no sword, tried to attack the healthies enemy first, then just my Clone first, then just archers etc etc… I feel like I need some sort of boost or any hint. Here is my current code, which only deals w archers because my hero dies too fast anyway so why bother with other enemies:

function bashAttack(enemyWho) {
    if (enemyWho) {
        while ( > 0) {
            if (hero.isReady("bash")) {
            } else {
var archers = hero.findByType("archer", hero.findEnemies());
var archerIndex = 0;
while (archerIndex < archers.length) {
    var archer = archers[archerIndex];


Use a weak sword with a good shield. Also use chain lightning if you have the emperor’s gloves.


Chaboi, that’s what i’m using right now, the basic sword and the best shield in the game. I don’t have gloves though and no money to buy it, is there a way to pass the level without them?


Have you tried the level with flags? It makes it much easier to beat than a standard attack code.


Believe it or not, I did. My hero literally ignored it. I even copy-pasted just that code for flags from the “manual”, just couple lines of code, then I’m trying to place the flags - no reaction…


Your code should be something like

while (true){
    var flag=hero.findFlag()
    var enemy=hero.findNearestEnemy()
    if flag{
    else if enemy{
        //Attack code


Chaboi, thanks a ton here, I didn’t put the flag code in the while loop. I’ll try now with flags, as I understand yaks play a big role here.


Key is to cast invis and go behind enemy archers and kill all of them


Yeah it depends, if you have both chain lightning and invis, you can invis back and chain lightning the archers. :man_shrugging:


Hei Chaboi, thanks so much, I passed. Actually, the flags and yaks were helpful.