Backwoods Forest: A fine Mint


#1

Hey dudes. I am having some problems on the Backwoods Forest level, A Fine Mint. I’m not sure exactly what’s wrong. Some help would be appreciated. Here’s my code.

while True:
    

    def pickUpCoin():
        coin = hero.findNearestItem()
        if coin:
            hero.moveXY(coin.pos.x, coin.pos.y)

# Write the attackEnemy function below.
# Find the nearest enemy and attack them if they exist!


while True:
    pickUpCoin()

#2

Don’t define a function inside of a while-true loop. Define it outside and then call it in the loop. :slight_smile:
Don’t forget to add your attackEnemy() function.


#3

Okay I’ll try that. Thanks!