Level 8,Wood Forest
Incorrect code:
enemy4 = Gorgnub
distance4 = hero.distanceTo(enemy4)
hero.say(distance4)
Thanks for reading!!
Level 8,Wood Forest
Incorrect code:
enemy4 = Gorgnub
distance4 = hero.distanceTo(enemy4)
hero.say(distance4)
Thanks for reading!!
You can’t copy and paste your code?
It seems to me that your code is correct. You can’t pass the level?
…,it can’t attack enemy 4
enemy4 = Gorgnub
distance4 = hero.distanceTo(enemy4)
hero.say(distance4)
Okay
Use parentheses around Gorgnub.
It should work after that.
wrong,it gives error
Gorgnub should be a string of characters. A string of characters is defined by quotes ( " ").
As your code is written, I dont think the game can figure out who Gorgnub is, try to make sure it understands that Gorgnub is a string !
That’s what I said isn’t it?
Try this. Gorbnub is a name, so therefore it is a string.
enemy4 = "Gorgnub"
distance4 = hero.distanceTo(enemy4)
hero.say(distance4)
oops.i typed it wrong.in the game level i also typed it but it is still wrong.
What? What are you saying?
Parentheses are ( )
Quotes are " "
still wrong
still wrong
can you give your full code?
put your preformatted text so, we can read your code better.
you can do that by using </> at the top of your text like this:
while True:
horse = hero.findFriends()
if horse:
friend = hero.findNearestFriend()
hero.attack(friend)
Right. Sorry about that.
while True:
horse = hero.findFriends()
if horse:
friend = hero.findNearestFriend()
hero.attack(friend)
ok?
He’s just showing you how to format it, that’s not the code you need. What is your current code?