Hunter Valley Shift 8

I’m stuck on the Hunter Valley level.

The bottom code mentions “Shift 8.” I have no idea what this means.

What is “shift”?
What is “the shift 8”?

// Escape to the right side of the valley.

// The function moves the hero to down and right.
function moveDownRight(shift) {
    hero.moveXY(hero.pos.x + shift, hero.pos.y - shift);
}
// The function moves the hero 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();
    }
    routeIndex += 1;
}
1 Like

I’m assuming that the parameter shift represents a sort of offset and “the shift 8” simply means replacing the unknown parameter shift with 8:
moveDownRight(shift) ==> moveDownRight(8)
Hope this helps :slightly_smiling_face:

2 Likes

I think the system may be mistaking that line for real code

1 Like

Shift is just another saying for move. For example, saying shift a tile down means move one tile down.

2 Likes