Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Backwood ambush A need help(solved)

# In this level you will use functions with two parameters.
# Look at the structure below, notice how there are two arguments.
# These are both accessible within the function. 

def checkAndAttack(x, y):
    # First move to the coordinates provided by the parameters
    enemy = hero.findNearestEnemy()
    hero.moveXY(x, y)
    # Then check for an enemy.
    if enemy:
        # If there is one, attack it!

    checkAndAttack(24, 42)
    checkAndAttack(27, 60)
# Navigate to the last 3 x-marks and defeat any remaining munchkins.

```Can anybody tell me what wrong with the line 8 (hero.moveXY(x, y)?
(hero.moveXY(x, y)    # ==> You added another bracket at the beginning
# Delete the first bracket or otherwise add another one at the end
1 Like
checkAndAttack(42.50) # ==> a typo, change the period to the comma
1 Like

noted and thanks EpicCoder999

no problem! (20 chars)

still not working :frowning:

Look at when you’re defining enemy, will the enemy be there when you check?

got it, level cleared. Thanks :slightly_smiling_face:

he did add the if-statement