Problem On Level "Ranger Finder" in Backwoods Forest


#1

So here’s the code I’m using;

enemy1 = "Gort"
distance1 = hero.distanceTo(enemy1)
hero.say(distance1)
enemy2 = "Smasher"
distance2 = hero.distanceTo(enemy2)
hero.say(distance2)
enemy3 = "Gorgnub"
distance3 = hero.distanceTo(enemy3)
hero.say(“distance3”)

yet the last enemy3 part of the code isn’t working and is firing at the cannon where the cannonball shoots out. I think this may be a bug, if not could anyone paste in a code that works?


#2

Compare these lines:

hero.say(distance2) # works
# vs
hero.say(“distance3”) # doesn't work
It's always nice to format your code

Use ``` (these are backticks) before and after your code to format it.
Add blank lines between sections of your code to improve readability.

enemy1 = "Gort"
distance1 = hero.distanceTo(enemy1)
hero.say(distance1)

enemy2 = "Smasher"
distance2 = hero.distanceTo(enemy2)
hero.say(distance2)

enemy3 = "Gorgnub"
distance3 = hero.distanceTo(enemy3)
hero.say(“distance3”)