# Basin Stampede Help

**URL:** <https://discourse.codecombat.com/t/basin-stampede-help/7177>\
**Category:** Level Help\
**Created:** [April 5, 2016, 6:14pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177 "2016-04-05T18:14:31Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [July 6, 2020, 3:22pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/22 "2020-07-06T15:22:54Z")

</div>

? You need to format your code correctly for us to be able to look at your code. So again, please use \</\> and paste your code.

---

<div class="post-metadata">

**Author:** ![Aaron5137](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@Aaron5137](https://discourse.codecombat.com/u/Aaron5137)\
**Post date:** [July 6, 2020, 3:23pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/23 "2020-07-06T15:23:32Z")

</div>

```python
while True:
    enemy = hero.findNearestEnemy()
    xPos = hero.pos.x + 5
    yPos = 17
    if enemy:
        # Adjust y up or down to get away from yaks.
        if enemy.pos.y > hero.pos.y:
            # If the Yak is above you, subtract 3 from yPos.
            hero.pos.y = #subtract 3 from the hero.pos.y
            pass
        elif enemy.pos.y < hero.pos.y:
            # If the Yak is below you, add 3 to yPos.
            hero.pos.y = #add 3 to hero.pos.y
            pass
    hero.moveXY(xPos, yPos)

```

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [July 6, 2020, 3:24pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/24 "2020-07-06T15:24:05Z")

</div>

Thanks. I’ll look at it now.

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 6, 2020, 3:24pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/25 "2020-07-06T15:24:56Z")

</div>

Try to look at this lines, does it seems anything wierd with them?

> [@Aaron5137](#):
>
> `hero.pos.y = #subtract 3 from the hero.pos.y`

> [@Aaron5137](#):
>
> `hero.pos.y = #add 3 to hero.pos.y`

Andrei

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [July 6, 2020, 3:27pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/28 "2020-07-06T15:27:07Z")

</div>

You wrote:

```python
hero.pos.y = #subtract 3 from the hero.pos.y

```

instead of that, you should type `hero.pos.y - 3`

---

<div class="post-metadata">

**Author:** ![Anna](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anna/32/8378_2.png) [@Anna](https://discourse.codecombat.com/u/Anna)\
**Post date:** [July 6, 2020, 3:28pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/29 "2020-07-06T15:28:08Z")

</div>

Don’t forget to redefine the variable when you do that.

---

<div class="post-metadata">

**Author:** ![Aaron5137](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@Aaron5137](https://discourse.codecombat.com/u/Aaron5137)\
**Post date:** [July 6, 2020, 3:28pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/30 "2020-07-06T15:28:34Z")

</div>

```python
i did it next:`while True:
    enemy = hero.findNearestEnemy()
    xPos = hero.pos.x + 5
    yPos = 17
    if enemy:
        # Adjust y up or down to get away from yaks.
        if enemy.pos.y > hero.pos.y:
            # If the Yak is above you, subtract 3 from yPos.
            hero.pos.y - 3
            pass
        elif enemy.pos.y < hero.pos.y:
            # If the Yak is below you, add 3 to yPos.
            hero.pos.y = #add 3 to hero.pos.y
            pass
    hero.moveXY(xPos, yPos)
`

```

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [July 6, 2020, 3:29pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/32 "2020-07-06T15:29:39Z")

</div>

Also, you wrote

```python
hero.pos.y = #add 3 to hero.pos.y

```

Instead of `#add 3 to hero.pos.y` , add 3 to hero.pos.y by `hero.pos.y = hero.pos.y + 3`

---

<div class="post-metadata">

**Author:** ![Aaron5137](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@Aaron5137](https://discourse.codecombat.com/u/Aaron5137)\
**Post date:** [July 6, 2020, 3:30pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/33 "2020-07-06T15:30:25Z")

</div>

```python
while True:
    enemy = hero.findNearestEnemy()
    xPos = hero.pos.x + 5
    yPos = 17
    if enemy:
        # Adjust y up or down to get away from yaks.
        if enemy.pos.y > hero.pos.y:
            # If the Yak is above you, subtract 3 from yPos.
            hero.pos.y - 3
            pass
        elif enemy.pos.y < hero.pos.y:
            # If the Yak is below you, add 3 to yPos.
            hero.pos.y + 3
            pass
    hero.moveXY(xPos, yPos)

```

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [July 6, 2020, 3:30pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/34 "2020-07-06T15:30:45Z")

</div>

Does that work for you?

---

<div class="post-metadata">

**Author:** ![Aaron5137](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@Aaron5137](https://discourse.codecombat.com/u/Aaron5137)\
**Post date:** [July 6, 2020, 3:31pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/35 "2020-07-06T15:31:23Z")

</div>

nope not at all i keep dieing

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [July 6, 2020, 3:33pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/36 "2020-07-06T15:33:24Z")

</div>

As I said earlier, instead of `hero.pos.y - 3` replace it with `hero.pos.y = hero.pos.y - 3`.

---

<div class="post-metadata">

**Author:** ![Anna](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anna/32/8378_2.png) [@Anna](https://discourse.codecombat.com/u/Anna)\
**Post date:** [July 6, 2020, 3:33pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/37 "2020-07-06T15:33:53Z")

</div>

@Rachel699 You mean yPos because that is the variable for the hero’s y position

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [July 6, 2020, 3:34pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/38 "2020-07-06T15:34:13Z")

</div>

Also, instead of `hero.pos.y + 3` replace it with `yPos = hero.pos.y + 3`

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [July 6, 2020, 3:34pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/39 "2020-07-06T15:34:42Z")

</div>

Oops… I wasn’t copy pasting… thanks for the reminder! 😅

---

<div class="post-metadata">

**Author:** ![Anna](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anna/32/8378_2.png) [@Anna](https://discourse.codecombat.com/u/Anna)\
**Post date:** [July 6, 2020, 3:35pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/40 "2020-07-06T15:35:29Z")

</div>

No problem! 😀

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [July 6, 2020, 3:38pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/41 "2020-07-06T15:38:00Z")

</div>

Does this work for you? 🙂

---

<div class="post-metadata">

**Author:** ![Aaron5137](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@Aaron5137](https://discourse.codecombat.com/u/Aaron5137)\
**Post date:** [July 6, 2020, 3:38pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/42 "2020-07-06T15:38:54Z")

</div>

````python
while True:
    enemy = hero.findNearestEnemy()
    xPos = hero.pos.x + 5
    yPos = 17
    if enemy:
        # Adjust y up or down to get away from yaks.
        if enemy.pos.y > hero.pos.y:
            # If the Yak is above you, subtract 3 from yPos.
            ypos = hero.pos.y - 3
            pass
        elif enemy.pos.y < hero.pos.y:
            # If the Yak is below you, add 3 to yPos.
            ypos = hero.pos.y + 3
            pass
    hero.moveXY(xPos, yPos)
```nope
````

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [July 6, 2020, 3:39pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/43 "2020-07-06T15:39:50Z")

</div>

Instead of `ypos` , make sure to capitalize it so it’s `yPos` . This should work.

---

<div class="post-metadata">

**Author:** ![Anna](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anna/32/8378_2.png) [@Anna](https://discourse.codecombat.com/u/Anna)\
**Post date:** [July 6, 2020, 3:42pm UTC](https://discourse.codecombat.com/t/basin-stampede-help/7177/44 "2020-07-06T15:42:09Z")

</div>

And if it does, please don’t post solutions. We want other users to learn, not copy and paste off the forum.

[Previous page](https://discourse.codecombat.com/t/basin-stampede-help/7177.md?page=1)

[Next page](https://discourse.codecombat.com/t/basin-stampede-help/7177.md?page=3)
