Help on The Oasis


#1

Hey guys I am having some problems with The Oasis. There are no errors or anything it just isn’t working. Here is my code:

while True:
    x = hero.pos.x
    y = hero.pos.y
    enemy = hero.findNearestEnemy()
    if enemy and hero.distanceTo(enemy) < 10:
        # Subtract 10 from x to move left.
        x -= 10
        hero.moveXY(x, y)
        # Use moveXY to move to the new x, y position.
        hero.moveXY(10, 29)
        pass
    else:
        # Add 10 to x to move right.
        x += 10
        hero.moveXY(x, y)
        # Use moveXY to move to the new x, y position.
        hero.moveXY(30, 29)
        pass


#2

Remove the

hero.moveXY(number, number)

just use the hero.moveXY(x,y)
define y = hero.pos.y
define x = hero.pos.x + 10 in the if loop, and x = hero.pos.x - 10 in the else loop


#3

in the beginning you define x. Then, after the if enemy statement, you define x again. Then you try to move to an x, y position. Try removing the x -= 10 and hero.moveXY(x, y) statements and just use the second hero.moveXY statement with (x -10, y) instead. The same goes for the lines under the else statement except with (x + 10, y).


#4

because what you are doing is that you are commanding the hero to simply move between coords

(10,29) and (30, 29)

#5

@SuperSmacker

Ha! Replying at the same time. LOL


#6

nope. i was 15 seconds b4 u. get sniped boi