Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Level: The Mighty Sand Yak


sorry sorry sorry, but i don’t know, how to win ?
what that “add logic” ?


I’ll change the wording. It means, “use an if-statement to only move when a yak is less than 10 meters away.” Does that help?


Thank ! Worked ! :smile:


… how do you do the distance from the sand yak? “SAND YAK - SAND-YAK” doesn’t work at all. neither does ‘sand-yak’ , or anything.


Sense “sand yak” is invisible you need to set it as enemy variable


ah thanks! was confusing me for a while


sand-yak does work

var enemy = this.findNearestEnemy();
if (enemy.type == “sand-yak” && this.distanceTo(enemy)<10)


On this level there are only Sand yaks, so you don’t need to worry about checking what type it is.


visual / UI bug
bouncing yellow arrow is pointing at nothing…
see screengrab below
browser: chrome
zoom = 100% (no zoom)


I believe the arrow is pointing to where the item is positioned inside the scrollable area (i.e. where it would be showing if the entire scrollable area was visible). You have to scroll down to see it. This is a known bug.

I’m not sure what would be the best solution. Perhaps an arrow pointing down/up inside the scrollable area when the item is not visible would be a good approach. E.g.:

Also, there is another issue with the arrow that does not follow the item while scrolling.


For this level, why add an extra line of code for adding 10 to x when you can directly write
hero.moveXY(x + 10, y)