Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Sarven road Bug? Fixed

# Get to the oasis. Watch out for new enemies: ogre scouts!
# Go up and right by adding to your current X and Y position.
enemy = self.findNearestEnemy()
x = self.pos.x
y = self.pos.y
    # Attack any enemies you see.
    if enemy:
    # Or, if there are no enemies in sight, keep moving up and to the right.
        self.moveXY(x + 10, y + 10)

My code is fine, but y guy just stops in one spot and dies (15, 15).


The reason that your hero stops is that you define your position outside the loop, so your position is permanently your starting point.


Put the
x= …
y= …
inside the loop