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

Hunter Valley pls help

// Escape to the right side of the valley.

// The function has the hero move to down and right.
function moveDownRight(shift) {
    hero.moveXY(hero.pos.x + shift, hero.pos.y - shift);
}

// The function has the hero move to up and right.
function moveUpRight(shift) {
    // Complete this function:
      hero.moveXY(hero.pos.x + shift, hero.pos.y - shift);
}


// The hunter is kind and will show the route.
var hunter = hero.findFriends()[0];
var route = hunter.route;
var routeIndex = 0;

while (routeIndex < route.length) {
    var direction = route[routeIndex];
    if (direction > 0) {
        moveUpRight(8);
    } 
    else {
        // Use a function moveDownRight with the shift 8:
        moveDownRight(8);
    }
    routeIndex += 1;
}

Pls help I am very stuck on this.

To start with a hint…it is critical to pay very close attention to + and - signs

Where’s hunter valley again? I’ve been working very hard on developing the #off-topic section.

It’s in the desert: https://codecombat.com/play/level/hunter-valley

@CoolDude

this is where you need to change to +

// The function has the hero move to up and right.
function moveUpRight(shift) {
    // Complete this function:
      hero.moveXY(hero.pos.x + shift, hero.pos.y - shift);
}

Everything else is looking good

Thank you it’s solved!

Mod edit: please don’t post solutions.

Hi, please don’t post solutions, as it’s against the purpose of the forum.
Thanks
Danny

@Deadpool198
Oh Sorry Bout That mate.

1 Like