Im stuck on the level and my guy is not saying the Fire! line.
while True:
# Find the nearest enemy and the distance to it.
Brawler = hero.findNearestEnemy()
distance = hero.distanceTo(“Brawler”)
if Brawler < 50:
# If the enemy’s type is “brawler”
# AND the distance to it is less than 50 meters,
# Then say “Fire!” to signal the artillery.
hero.say(“Fire!”)
pass
Hello @ONION165 welcome to the discourse! Seeing that you never got welcomed, make sure to read the FAQ and format your code with the </> button! As for the issue:
-
Remove the quotes around "Brawler"
in hero.distanceTo("Brawler")
. This should reference the Brawler variable, not string "Brawler"
.
-
Remove Brawler
from the if statement and replace it with distance
, as brawler is a thing, not a number or integer.
This should work.
Feel free to @ me if it does not.
1 Like