# Help with Backwoods Forest\[SOLVED\]

**URL:** <https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209>\
**Category:** Level Help\
**Created:** [December 20, 2020, 6:35pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209 "2020-12-20T18:35:32Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![elemersglue](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@elemersglue](https://discourse.codecombat.com/u/elemersglue)\
**Post date:** [December 20, 2020, 6:35pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/1 "2020-12-20T18:35:32Z")

</div>

cannot figure out why my code is incorrect

```python
# Use the checkAndAttack function to make your code easy to read.

# This function has a parameter.
# An parameter is a way of passing information into a function.
def checkAndAttack(target):
    # The 'target' parameter is just a variable!
    # It contains the argument when the function was called.
    if target:
        hero.attack(target)
    hero.moveXY(43, 34)

enemy = hero.findNearestEnemy()
checkAndAttack(enemy)

while True:
    hero.moveXY(58, 52)
    topEnemy = hero.findNearestEnemy()
    checkAndAttack(topEnemy) 
    # Move to the bottom X mark.
    hero.moveXY(58, 16)
    # Create a variable named bottomEnemy and find the nearest enemy.
    bottomEnemy = hero.findNearestEnemy()
    # Use the checkAndAttack function, and include the bottomEnemy variable.
    checkAndAttack(bottomEnemy)

```

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [December 20, 2020, 6:39pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/2 "2020-12-20T18:39:53Z")

</div>

Welcome to the forum!! What level is this?

---

<div class="post-metadata">

**Author:** ![elemersglue](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@elemersglue](https://discourse.codecombat.com/u/elemersglue)\
**Post date:** [December 20, 2020, 6:52pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/3 "2020-12-20T18:52:44Z")

</div>

Thanks Eric! This is Backwoods Fork under Backwoods Forest [https://codecombat.com/play/level/backwoods-fork](https://codecombat.com/play/level/backwoods-fork)

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [December 20, 2020, 6:55pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/4 "2020-12-20T18:55:30Z")

</div>

> [@elemersglue](#):
>
> ```python
> enemy = hero.findNearestEnemy()
> checkAndAttack(enemy)
> 
> ```

delete this, It _SHOuld_ work

---

<div class="post-metadata">

**Author:** ![jka2706](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jka2706/32/13636_2.png) [@jka2706](https://discourse.codecombat.com/u/jka2706)\
**Post date:** [December 20, 2020, 6:56pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/5 "2020-12-20T18:56:28Z")

</div>

Hi elemersglue,

Your code works fine for me. Are you getting an error message, or is the hero not succeeding? Can you take a screenshot of you equipment and post it here?

Jenny

---

<div class="post-metadata">

**Author:** ![elemersglue](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@elemersglue](https://discourse.codecombat.com/u/elemersglue)\
**Post date:** [December 20, 2020, 6:57pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/6 "2020-12-20T18:57:21Z")

</div>

> [@elemersglue](#):
>
> ```python
> # Use the checkAndAttack function to make your code easy to read.
> 
> # This function has a parameter.
> # An parameter is a way of passing information into a function.
> def checkAndAttack(target):
> # The 'target' parameter is just a variable!
> # It contains the argument when the function was called.
> if target:
> hero.attack(target)
> hero.moveXY(43, 34)
> 
> enemy = hero.findNearestEnemy()
> checkAndAttack(enemy)
> 
> while True:
> hero.moveXY(58, 52)
> topEnemy = hero.findNearestEnemy()
> checkAndAttack(topEnemy) 
> # Move to the bottom X mark.
> hero.moveXY(58, 16)
> # Create a variable named bottomEnemy and find the nearest enemy.
> bottomEnemy = hero.findNearestEnemy()
> # Use the checkAndAttack function, and include the bottomEnemy variable.
> checkAndAttack(bottomEnemy)
> 
> ```

deleted it and no luck ☹

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [December 20, 2020, 6:58pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/7 "2020-12-20T18:58:06Z")

</div>

I think jka might be right I think it is a equipment issue you might need more health but I dont think so.

---

<div class="post-metadata">

**Author:** ![elemersglue](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@elemersglue](https://discourse.codecombat.com/u/elemersglue)\
**Post date:** [December 20, 2020, 6:59pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/8 "2020-12-20T18:59:32Z")

</div>

![Screen Shot 2020-12-20 at 10.59.17 AM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/1/e/1e3de86dcb2581ee8475f7bdb2d469dffc74e33a.jpeg) hi there! this is the error i’m getting 🙂

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [December 20, 2020, 7:00pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/9 "2020-12-20T19:00:00Z")

</div>

yeah its totally a equipment issue.

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [December 20, 2020, 7:02pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/10 "2020-12-20T19:02:37Z")

</div>

you don’t have a sword powerfull anoghf to one shoot the munchkins and because of that your hero attacks the munchkin once then proceeds to move to the next X so maybe make your hero attach two times before moving to the next X

---

<div class="post-metadata">

**Author:** ![elemersglue](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@elemersglue](https://discourse.codecombat.com/u/elemersglue)\
**Post date:** [December 20, 2020, 7:46pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/11 "2020-12-20T19:46:10Z")

</div>

thank you! i adjusted my equipment and it works now omg thank you SO much

---

<div class="post-metadata">

**Author:** ![elemersglue](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@elemersglue](https://discourse.codecombat.com/u/elemersglue)\
**Post date:** [December 20, 2020, 7:47pm UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/12 "2020-12-20T19:47:02Z")

</div>

thanks a milllion!!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/a9445509d1a758c41b5ddcddc8c8e20a5dedb67f.png) [@system](https://discourse.codecombat.com/u/system)\
**Post date:** [December 21, 2020, 7:47am UTC](https://discourse.codecombat.com/t/help-with-backwoods-forest-solved/26209/13 "2020-12-21T07:47:06Z")

</div>

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
