no (20 characters is annoying)
How do we know their id?
So in this level, use
to find the enemy.
Then to find their id, just do:
while True: friend = hero.findNearestFriend() if friend: hero.say("To battle, " + friend.id + "!") # Now find the nearest enemy and tell them to go away. hero.findNearestEnemy() if enemy: enemy = hero.findNearestEnemy() # What do I put here on this line?
What do I put on that line
And the ogres names are peon.
enemy = hero.findNearestEnemy() OUT of the
if enemy:. You are defining the enemy after stating it. The computer will not know what “enemy” is until you define it. That’s why
if enemy: enemy = hero.findNearestEnemy() will not work.