I’m trying to do this level but my character just gets into a loop. Can someone help?

```
#lpx and lpy == lastPositionX and lastPositionY
x = hero.pos.x
y = hero.pos.y
while True:
downClear = hero.isPathClear(hero.pos,{'x':hero.pos.x,'y':hero.pos.y - 16})
if downClear and y - 16 != lpy:
lpx = x
lpy = y
y-=16
hero.moveXY(x,y)
leftClear = hero.isPathClear(hero.pos,{'x':hero.pos.x + 16, 'y':hero.pos.y})
if leftClear and x - 16 != lpx:
lpx = x
lpy = y
x+=16
hero.moveXY(x,y)
rightClear = hero.isPathClear(hero.pos,{'x':hero.pos.x- 16, 'y':hero.pos.y})
if rightClear and x + 16 != lpx:
lpx = x
lpy = y
x-=16
hero.moveXY(x,y)
upClear= hero.isPathClear(hero.pos,{'x':hero.pos.x,'y':hero.pos.y + 16})
if upClear and y + 16 != lpy:
lpx = x
lpy = y
y+=16
hero.moveXY(x, y)
```