Lost Viking Help Hero don't move


#1

Proszę o pomoc hero się nie rusza

// You MUST click on the HELP button to see a detailed description of this level!
// The raven will tell you what to use for your maze parameters!
var SLIDE = 10;
var SWITCH = 7;
var SKIP = 11;
// How many sideSteps north of the Red X you've taken.
var sideSteps = 1;
// How many steps east of the Red X you've taken.
var steps = 1;
// Multiply this with steps to determine your X coordinate. DON'T CHANGE THIS!
var X_PACE_LENGTH = 4;
// Multiply this with sideSteps to determine your Y coordinate. DON'T CHANGE THIS!
var Y_PACE_LENGTH = 6;
var x = 1;
// The maze is 35 steps along the X axis.
while (steps <= 35) {
    // Take the next step:
    hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
    if (steps % SWITCH === 0) {
        x = -x;
    }
    // Increment steps and sideSteps as appropriate, taking into account the special rules.
    if (steps % SKIP === 0) {
        sideSteps += x;
        steps += 1;
        sideSteps += x;
    }
    if (sideSteps > SLIDE) {
        sideSteps = 1;
    }
    if (sideSteps < 1) {
        sideSteps = SLIDE;
    }
}


#2

You need to increase the number of steps taken every time you take a step. Even though there are special rules, the special rules don’t happen all the time. They take care of the special cases but you still need to code the part about ordinary cases.


#3

My hero goes to the second point
I do not know how my hero should go up

while (steps <= 35) {
    // Take the next step:
    steps++;
    sideSteps+=x;
    hero.moveXY(steps *  X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
    if (steps % SWITCH === 0 && hero.pos.x > 6) {
        x = -x;
    }
    // Increment steps and sideSteps as appropriate, taking into account the special rules.
    else if (steps % SKIP === 0 && hero.pos.x > 6) {
        sideSteps += x;
    }
    else if (sideSteps < 1) {
        sideSteps = 10;
    }
    else if (sideSteps > 10) {
        sideSteps = 1;
    }   
}