CodeCombat - Thunderhooves [Solved]

Could somebody please help me with this level? I don’t understand how to do it!

My code:

while True:
    yak = hero.findNearestEnemy()
    if yak:
        # If yak.pos.y is greater than hero.pos.y
        if yak.pos.y > hero.pos.y:
            # buildXY a "fence" 10m below the yak.
            hero.buildXY("fence", yak.pos.x, yak.pos.y - 10)
            # else: 
        else:
            # buildXY a "fence" 10m above the yak.
            hero.buildXY("fence", yak.pos.x, yak.pos.y + 10)
        pass
    else:
        # moveXY right 10m towards the oasis.
        hero.moveXY(xPos = hero.pos.x, yPos = hero.pos.y + 10)
        pass

Could somebody PLEASE help me?

Like @thebagel, @Deadpool198, @abc, @CryptiCrystal, ect.

Anyone? Help? (20 char)

Please? (20 characters)

Don’t @ people too much. They may not be on right now.

1 Like

Just do hero.moveXY(hero.pos.x + 10, hero.pos.y) here.

Okay. (20 characters)

Thank You! It worked!

1 Like

please don’t ping everyone that you know of. It’s really annoying, and someone will notice your post and come to help you.

1 Like

Ok. Sorry. (20 char)

1 Like

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