Level: The Mighty Sand Yak


#1

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


#2

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?


#3

Thank ! Worked ! :smile:


#4

… 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.


#5

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


#6

ah thanks! was confusing me for a while


#7

sand-yak does work

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


#8

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


#10

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


#11

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.


#12

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)