[SOLVED] Boulder Woods help

Hi all, I swear I’ve got this correct (but obviously I mustn’t have :stuck_out_tongue: )
CodeCombat - Coding games to learn Python and JavaScript?

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)
        dest = ({'x':targetX,'y':targetY})
        # Use isPathClear between your current `pos` and the target.
        # If the path is clear, move to the target.
        if hero.isPathClear(hero.pos, dest):
            hero.move(dest)
        # Otherwise, sweep the `angle` clockwise a bit.
        angle -= Math.PI / 16

Any help would be appreciated!

1 Like

Oh, this one was weird.

ok, you’re super close, and you did get it right, but Something’s wrong with the start code I think.

These should be 10’s not 5’s (I changed that myself to make it work)

That’s it!

@Chaboi_3000 can you check this please?

by the way, welcome back man!

1 Like

Why is this bugs? It should be #level-help.

I just changed it, @milton.jinich. I’m pretty sure the start code is wrong.

I found the problem. It is the last line. It should be in a else statement.

1 Like

Yes, that’s right, good catch. But my code still wont work with the numbers at 5.

1 Like

Yep, it was the ‘else’ clause. Thanks all!

2 Likes

Congrats! Please mark whichever solution helped solve your problem with that little :white_check_mark:

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.