Hey everyone I have been having some trouble on Long Range Division. It says line 8 distance isn’t defined.
here is the code:
enemy = hero.findNearestEnemy()
distanceToEnemy = hero.distanceTo(enemy)
# Say first Range: distanceToEnemy divided by 3
if distance == hero.distanceTo(enemy) / 3:
hero.say("Fire!")
# Say second range: distanceToEnemy divided by 1.5
if distamce == hero.distanceTo(enemy) / 2:
hero.say("Fire!")
# Say these things for motivation. Really. Trust us.
hero.say("Woo hoo!")
hero.say("Here we go!")
hero.say("Charge!!")
# Now, use a while-true loop to attack the enemies.
while True:
hero.attack(enemy)
Thanks for the help!