I get a “time error” ending.I just wanna say if i did not complete “Dodge four yaks” task, I must be killed that means that I am not alive.Who can tell me the reason why I am alive, but cannot pass this task?THX.
Here is my js code:
a = 10;
loop {
// Use "if" to only move when a yak is less than 10m away.
// Move right by adding to your current X position.
// Use your Sense Stone to access this.pos.
if (this.pos.x > 40) {
a = -10;
} else if (this.pos.x < 21) {
a = 10;
}
enemy = this.findNearestEnemy();
if (enemy)
if (enemy.pos.x > this.pos.x - 5 &&
enemy.pos.x < this.pos.x + 5) {
this.moveXY(this.pos.x + a, this.pos.y);
}
}