The Mighty Sand Yak Help (Python) (SOLVED)

I don’t know how to do it

Can you send your code here? Or do you have no code?

Let yaks get close, then move 10m right to dodge.

Dodge 4 yaks to complete the level.

while True:
# Get hero’s current x and y position.
x = hero.pos.x
y = hero.pos.y

# Find the nearest yak.
yak = hero.findNearestEnemy()

# If the distanceTo the yak is less than 10:
if hero.distanceTo(yak) < 10:
    # To move right, add 10 to hero's x position.
    hero.moveXY(+ 10)
    # Use moveXY(x, y) to move!
    
    pass

Tips:

  1. hero.moveXY() needs 2 parameters, you need to behero.moveXY(hero.pos.x, hero.pos.y + number

I don’t know python much, but I think you should put the x and the y in the hero.moveXY

Hint
hero.moveXY(x + 10, y)

I didi the Mighty Sand Yak

1 Like

Need code for that level?

No, solutions are not allowed on the discourse so its fine :+1:

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.