Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Web Development 2, Level 9

This is a Javascript only level. When I go to this level, the level always runs out of time. There is another level with the same name in Backwoods Forest, where you can choose Python or Javascript. When I go to the Python or Javascript level in Backwoods Forest, changed to Javascript, I paste my code and it works fine. Note that this is the exact same level with the same name and character. Here’s my code.

function pickUpCoin() {
    var coin = hero.findNearestItem();
    if(coin) {
        hero.moveXY(coin.pos.x, coin.pos.y);
    }
}

function attackEnemy(){
    var enemy = hero.findNearestEnemy();
    if(enemy){
        hero.attack(enemy);
    }
}

while(true) {
    attackEnemy();
    pickUpCoin();
}

What is the name of the level?

2 Likes

Transformative properties

Try resummiting, maybe it was just a bad seed if you say that this code worked on the other account of yours. Have you completed the level?

2 Likes

I think you mean Level 19, right? https://codecombat.com/play/level/transformative-properties?

No, it is a Fine Mint, Javascript. I meant Level 9 not 19. It said in the title level 9.

Sorry got confuzzled

No worries…found it :slightly_smiling_face:

I pasted your code in and it completed fine. While it appears to be identical to the Forest level, my guess is that there is a subtle difference. I’m thinking it has got to be equipment based. My hero has Boots of Leaping and the Speed ring…are you using these?

Also, what happens if you switch the web dev lesson to PY? You can easily do this by adding ‘codeLanguage=python’ right after the ? in the URL…like this:
https://codecombat.com/play/level/javascript-a-fine-mint?&codeLanguage=javascript

only, instead of saying =javascript, put =python instead.

ok(20 chars hjgyftyty)

That I think would lead to the Forest Level. But I don’t know.

I got a higher speed boot and it worked.
Thanks!