please help if you know how to do this level.
post your code so we can help u
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 ???
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.
enemy = hero.findNearestEnemy()
result = 0
result = hero.distanceTo(enemy)
return == 0
# 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