# Use isPathClear to move around the randomly positioned boulders.
# Automatic pathfinding doesn't work in Boulder Woods.
while True:
angle = Math.PI / 2 - Math.PI / 16
while angle >= -Math.PI / 2:
targetX = hero.pos.x + 5 * Math.cos(angle)
targetY = hero.pos.y + 5 * Math.sin(angle)
# Use isPathClear between your current `pos` and the target.
# If the path is clear, move to the target.
# Otherwise, sweep the `angle` clockwise a bit.
angle -= Math.PI / 16
This comment is telling you to check with an if-statement, that if the path is clear.
A proper isPathClear function would be hero.isPathClear (hero.pos, #where you want to end)
In this case, it would be ```hero.isPathClear(hero.pos,{‘x’:targetX, ‘y’:targetY})
If the if statement is true, then move your hero to targetX and targetY
And the rest looks good!
Lydia
After you tried Lydia’s advice, it should work.
But next time, try the level out yourself before asking for help, because it doesn’t seem that you’ve tried the level.