Copper Meadows code issues - Javascript (SOLVED)

Hi! I am stuck in this level, could anyone help me? please :frowning:

Below I will share the code…

Javascript code here:

// Collect all the coins in each meadow.
// Use flags to move between meadows.
// Press Submit when you are ready to place flags.

while(true) {
    var flag = hero.findFlag();
    if (flag) {
        // Pick up the flag.
    } else {
        // Automatically move to the nearest item you see.
        //IDK HERE
        var item = hero.findNearestItem();
        if (item) {
            var position = item.pos;
            var x = position.x;
            var y = position.y;
            hero.moveXY(x, y);

Your code is correct. This level uses flags, which allow you to feed information to your hero.

Click submit. While the level runs, you should have the option to drop flags on the map by clicking on a color in the lower left and then on a location on the map. The provided code should guide your hero to the dropped flag.

1 Like

Oh God! I was already worrying…
it was impossible for me to solve it hahaha

Thank you very much for your help!


Hi, glad you fixed it! Could you delete your code please since it’s correct and we don’t want to cheat.

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.