# Backwood ambush A need help(solved)

**URL:** <https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953>\
**Category:** Level Help\
**Created:** [June 1, 2020, 3:24pm UTC](https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953 "2020-06-01T15:24:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![toonben](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/toonben/32/12178_2.png) [@toonben](https://discourse.codecombat.com/u/toonben)\
**Post date:** [June 1, 2020, 3:24pm UTC](https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953/1 "2020-06-01T15:24:56Z")

</div>

````python
# 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:
        hero.attack(enemy)
        # If there is one, attack it!
    
    pass

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

```Can anybody tell me what wrong with the line 8 (hero.moveXY(x, y)?
Thank
````

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [June 1, 2020, 4:14pm UTC](https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953/2 "2020-06-01T16:14:40Z")

</div>

```python
(hero.moveXY(x, y) # ==> You added another bracket at the beginning
# Delete the first bracket or otherwise add another one at the end

```

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [June 1, 2020, 4:15pm UTC](https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953/3 "2020-06-01T16:15:57Z")

</div>

```python
checkAndAttack(42.50) # ==> a typo, change the period to the comma

```

---

<div class="post-metadata">

**Author:** ![toonben](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/toonben/32/12178_2.png) [@toonben](https://discourse.codecombat.com/u/toonben)\
**Post date:** [June 1, 2020, 4:52pm UTC](https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953/4 "2020-06-01T16:52:07Z")

</div>

noted and thanks EpicCoder999

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [June 1, 2020, 5:03pm UTC](https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953/5 "2020-06-01T17:03:16Z")

</div>

no problem! (20 chars)

---

<div class="post-metadata">

**Author:** ![toonben](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/toonben/32/12178_2.png) [@toonben](https://discourse.codecombat.com/u/toonben)\
**Post date:** [June 1, 2020, 5:07pm UTC](https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953/6 "2020-06-01T17:07:17Z")

</div>

still not working ☹

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [June 1, 2020, 5:20pm UTC](https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953/7 "2020-06-01T17:20:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![toonben](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/toonben/32/12178_2.png) [@toonben](https://discourse.codecombat.com/u/toonben)\
**Post date:** [June 1, 2020, 5:34pm UTC](https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953/8 "2020-06-01T17:34:20Z")

</div>

got it, level cleared. Thanks 🙂

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [June 1, 2020, 8:08pm UTC](https://discourse.codecombat.com/t/backwood-ambush-a-need-help-solved/21953/9 "2020-06-01T20:08:07Z")

</div>

he did add the `if-statement`
