[SOLVED] Help with Mighty Sand Yak

Hi i need help with the mighty sand yak if anyone could help me thanks.

# 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(x, y)
        # Use moveXY(x, y) to move!
        hero.moveXY(28,30)
        if hero.distanceTo(yak) < 10:
                hero.moveXY(15,30)
    pass
    
    

Replace that with this

if hero.distanceTo(yak) < 10:
        # To move right, add 10 to hero's x position.
        x = x + 10
        # Use moveXY(x, y) to move!
        hero.moveXY(hero.pos.x + 10, hero.pos.y)

Thats all I think.

Thanks again @milton.jinch!

No prob. In future try not to hard code things because things get really hard.

haha i see thanks for the tip

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