# Village Guard how to do it

**URL:** https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578
**Category:** Uncategorized
**Created:** [January 25, 2016, 5:05pm UTC](https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578 "2016-01-25T17:05:04Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![JohnCena101](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@JohnCena101](https://discourse.codecombat.com/u/JohnCena101)
#### Post date: [January 25, 2016, 5:05pm UTC](https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578/1 "2016-01-25T17:05:04Z")

</div>

I can not do this level i get it to work but my guy is to slow can you help me

---

<div class="post-metadata">

### Author: ![Steven\_Kang2003](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@Steven\_Kang2003](https://discourse.codecombat.com/u/Steven_Kang2003)
#### Post date: [January 25, 2016, 7:38pm UTC](https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578/2 "2016-01-25T19:38:15Z")

</div>

so can i see your gear and your code  
how much gems do you have

---

<div class="post-metadata">

### Author: ![Steven\_Kang2003](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@Steven\_Kang2003](https://discourse.codecombat.com/u/Steven_Kang2003)
#### Post date: [January 25, 2016, 7:38pm UTC](https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578/3 "2016-01-25T19:38:51Z")

</div>

i recommend speed ring if you can afford it and softened leather boots  
they make you faster

---

<div class="post-metadata">

### Author: ![Thelightside](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Thelightside](https://discourse.codecombat.com/u/Thelightside)
#### Post date: [January 25, 2016, 11:09pm UTC](https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578/4 "2016-01-25T23:09:11Z")

</div>

Can you please give us your code to help you.

---

<div class="post-metadata">

### Author: ![AdrianCgw](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@AdrianCgw](https://discourse.codecombat.com/u/AdrianCgw)
#### Post date: [January 26, 2016, 12:15am UTC](https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578/5 "2016-01-26T00:15:27Z")

</div>

The enemies on this level are hard coded to appear only when you reach the marked point. So your speed is not important at all. Just attack 2 times to kill an enemy if you have the basic sword

The prewritten code aready shows how to kill the enemies on one side. Just duplicated it for the other side.

---

<div class="post-metadata">

### Author: ![JohnCena101](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@JohnCena101](https://discourse.codecombat.com/u/JohnCena101)
#### Post date: [January 27, 2016, 12:29am UTC](https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578/6 "2016-01-27T00:29:01Z")

</div>

my code is

@moveXY 35, 34  
rightEnemy = @findNearestEnemy()  
if rightEnemy  
@attack rightEnemy  
@attack rightEnemy

---

<div class="post-metadata">

### Author: ![AdrianCgw](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@AdrianCgw](https://discourse.codecombat.com/u/AdrianCgw)
#### Post date: [January 27, 2016, 1:30am UTC](https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578/7 "2016-01-27T01:30:31Z")

</div>

Enemies come from each side. So the code must be like:

```python
loop
    go to right side
    if there is an enemy there
        kill it
    go to left side
    if there is an enemy there
        kill it

```

I know the code for one side is already written, You just have to write the code for the other side.

---

<div class="post-metadata">

### Author: ![JohnCena101](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@JohnCena101](https://discourse.codecombat.com/u/JohnCena101)
#### Post date: [January 27, 2016, 4:42pm UTC](https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578/8 "2016-01-27T16:42:06Z")

</div>

going to the right is that xy or move right

---

<div class="post-metadata">

### Author: ![Steven\_Kang2003](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@Steven\_Kang2003](https://discourse.codecombat.com/u/Steven_Kang2003)
#### Post date: [January 27, 2016, 5:01pm UTC](https://discourse.codecombat.com/t/village-guard-how-to-do-it/6578/9 "2016-01-27T17:01:41Z")

</div>

X,Y i think 🙂
