Backwoods Forest: A fine Mint

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()
1 Like

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.

1 Like

Okay I’ll try that. Thanks!

1 Like