I’m trying to complete blind distance but i always run out of time because the wizard gets too tired too fast because he needlessly attacks when he doesn’t need too so i fail i have tried using stuff that isn’t involved in the level but no matter what it fails over and over its frustrating.
Can you please post your code?
Here you go.
# Tell the wizard the distance to the coming ogres. # This function finds the nearest enemy and returns the distance to it. # If there is no enemy, the function returns 0. def nearestEnemyDistance(): enemy = hero.findNearestEnemy() result = 0 if enemy: result = hero.distanceTo(enemy) return result while True: # Call nearestEnemyDistance() and # save the result in the variable enemyDistance. enemyDistance = nearestEnemyDistance() # If the enemyDistance is greater than 0: if enemyDistance<10 : # Say the value of enemyDistance variable. hero.say("10")
Why would you command your hero to
say("10")? Surely you defined the variable enemyDistance for a reason. Maybe for you need to say enemyDistance (hint )
And of course now it works -_-
What did you change to make it work?
thx very much i solved it
been a great help
hope i enquire for more problems
I want to know as well.
I am stuck on this level:yum:
The 10 does not work for me why?
If you want help with your code, please could you post it on the discourse (formatted as it states in the FAQ) and say what you’re having trouble with. Thanks (also I don’t think @innerdesert4346 is active any more)
Thanks it worked and it is really helpfull