Feedback: Picnic Buster


#1

I was testing out Picnic Buster today, and I noticed that my hero would always start moving to the left side bushes after killing a munchkin, which left my two peasants defenseless. I fixed this by checking the enemy’s distance, but that was not mentioned in the comments or hints. Here is my code (without the distanceTo() function, of course), just to make sure I didn’t make a really dumb mistake.

# Remember that enemies may not yet exist.
while True:
    enemy = hero.findNearest(hero.findEnemies())
    # If there is an enemy, attack it!
    if enemy:
        hero.attack(enemy)

Hopefully my formatting is correct, please let me know if it is wrong. Thanks! :slight_smile:


#2

Are you using “through wall” glasses?


#3

Oh, that’s the problem. Thanks!