Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Help backwoods blind distance

please help if you know how to do this level.

post your code so we can help u

here it is

Line 19. You have the hero.say a set number. Is the distance to every enemy going to be 14? This is why we use variables. That way, no matter what the distance is, the hero will say that number. Use your variables instead of fixed numbers.

how do i do that ???

For example

a = hero.findNearestEnemy().type #<- This variable will not be fixed to a certain type like "Ogre"
hero.say(a)
#OUTPUT:
"Ogre"
"Munchkin"
"Witch"
"Warlock"

i don’t follow???

do you have something that says herosays() or something like that

this is my code

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
return == 0
while True:
# Call nearestEnemyDistance() and
# save the result in the variable enemyDistance.
enemyDistance = nearestEnemyDistance()
# If the enemyDistance is greater than 0:
if enemyDistance > 0:

# Say the value of enemyDistance variable.
 hero.say("7")

I also need help