There is a bug in the Slalom level, where despite my code being completely fine, the game is pointing out errors that don’t exist, sometimes even the comments in the code are marked as an error. And the line in which the error is in is different each time I restart the level. Please help.
1 Like
Can you send the code so i can test it ?
// Use object literals to walk the safe path and collect the gems.
// You cannot use moveXY() on this level! Use move() to get around.
var gems = hero.findItems();
while (hero.pos.x < 20) {
// move() takes objcts with x and y properties, not just numbers.
hero.move({'x': 20, 'y': 35});
}
while (hero.pos.x < 25) {
// A gem's position is an object with x and y properties.
var gem0 = gems[0];
hero.move(gem0.pos);
}
// While your x is less than 30,
// Use an object to move to 30, 35.
while(hero.pos.x < 30) {
hero.move({'x': 30, 'y': 35});
}
// While your x is less than 35,
while(hero.pos.x < 35) {
var gem1 = gems[1]
hero.move(gem1.pos);
}
while(hero.pos.x < 40) {
hero.move({'x': 40, 'y': 35});
}
while(hero.pos.x < 45) {
var gem[2]
hero.move(gem.pos);
}
while(hero.pos.x < 50) {
hero.move({'x': 50, 'y': 35});
}
while(hero.pos.x < 55) {
var gem3 = gems[3]
hero.move(gem3.pos);
}
1 Like
Oh, you forgot the semi-colons:
var gem1 = gems[1] ----> var gem1 = gems[1];
Try to put the semi-colons after the var commands
not a bug tho, put it in Level Help
and for code sake, put spaces after the while:
while (hero.pos.x < 35) {
var gem1 = gems[1];
hero.move(gem1.pos);
}
and not:
while(hero.pos.x < 35) {
var gem1 = gems[1]
hero.move(gem1.pos);
}
It worked. Thank you. Also I don’t know how to edit the post.
No problem. Just set the post on resolved
I am also facing the same issue, Thanks for asking.