# \[SOLVED\]Basin Stampede help python

**URL:** <https://discourse.codecombat.com/t/solved-basin-stampede-help-python/26121>\
**Category:** Level Help\
**Created:** [December 16, 2020, 1:09am UTC](https://discourse.codecombat.com/t/solved-basin-stampede-help-python/26121 "2020-12-16T01:09:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackbottle8259](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/blackbottle8259/32/17628_2.png) [@blackbottle8259](https://discourse.codecombat.com/u/blackbottle8259)\
**Post date:** [December 16, 2020, 1:09am UTC](https://discourse.codecombat.com/t/solved-basin-stampede-help-python/26121/1 "2020-12-16T01:09:15Z")

</div>

```python
# Keep moving right, but adjust up and down as you go.

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.moveXY(xPos, yPos-3)
            pass
        elif enemy.pos.y < hero.pos.y:
            # If the Yak is below you, add 3 to yPos.
            hero.moveXY(xPos,yPos+3)
            pass
    hero.moveXY(xPos, yPos)

```

---

<div class="post-metadata">

**Author:** ![blackbottle8259](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/blackbottle8259/32/17628_2.png) [@blackbottle8259](https://discourse.codecombat.com/u/blackbottle8259)\
**Post date:** [December 16, 2020, 1:18am UTC](https://discourse.codecombat.com/t/solved-basin-stampede-help-python/26121/2 "2020-12-16T01:18:16Z")

</div>

Never mind I already completed the level

---

<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 16, 2020, 1:18pm UTC](https://discourse.codecombat.com/t/solved-basin-stampede-help-python/26121/3 "2020-12-16T13:18:29Z")

</div>

Closed on December 16, 2020, 1:18pm UTC

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