Treasured in Ice help!

This is my code:

while True:
    pathUp = hero.isPathClear({'x':hero.pos.x,'y':hero.pos.y + 10})
    pathDown = hero.isPathClear({'x':hero.pos.x,'y':hero.pos.y - 10})
    pathRight = hero.isPathClear({'x':hero.pos.x- 10, 'y':hero.pos.y})
    pathLeft = hero.isPathClear({'x':hero.pos.x + 10, 'y':hero.pos.y})
    if pathUp:
        hero.moveUp()
    if pathDown:
        hero.moveDown()
    if pathRight:
        hero.moveRight()
    if pathLeft:
        hero.moveLeft()

Why does it keep on returning error? That’s all I need to know.

is path clear needs a start and a end, so the code should be

pathUp = hero.isPathClear(hero.pos, {'x':hero.pos.x,'y':hero.pos.y + 10})
2 Likes