Level: The Mighty Sand Yak

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

1 Like

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?

2 Likes

Thank ! Worked ! :smile:

1 Like

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

1 Like

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

1 Like

ah thanks! was confusing me for a while

1 Like

sand-yak does work

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

1 Like

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

3 Likes

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

1 Like

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.

1 Like

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)

hi there i am stuck on this level

Can you show us your code?

Andrei

1 Like

in five minutes

[en_US.composer.my_button_text]