[SOLVED] Drop The Flag Level Help in Backwoods Forest

Thanks a lot:pray::pray::pray:


why my code is not work!

Line 8 says,

# (Look below at how to get x and y from items.)

This is telling you that lines 9, 10, and 11 should be exactly like lines 17, 18, and 19 except using flag instead of item. Try that.

1 Like

Thank you MunkeyShynes I’m going to try this. :pray: :grinning:

I did exactly your command
but is not work again

After making the changes, did you click on SUBMIT or RUN? When using flags, you must click SUBMIT to test your code.

1 Like

yes I did , when I use flags , hero stopped in his location

It’s hard to tell for sure in the screen shot, but it looks like the last character in line 10 is an upper case X. It should be lower case.

2 Likes

Yes, thank you very much ,its work now:pray:


what is wrong!!!

You put capital P on the line with the error and în the flagX and flagY when you should not. Try to fix that.

1 Like

Thanks but now when I try to put down a flag, my hero freezes

:sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob:why

Can you resend your code ?

Put flags where you want to build traps.

When you’re not building traps, pick up coins!

while True:
flag = hero.findFlag()
if flag:
# How do we get flagX and flagY from the flag’s pos?
# (Look below at how to get x and y from items.)
flagpos = flag.Pos
flagX = flagPos.x
flagY = flagPos.y
hero.buildXY(“fire-trap”, flagX, flagY)
hero.pickUpFlag(flag)
else:
item = hero.findNearestItem()
if item:
itemPos = item.pos
itemX = itemPos.x
itemY = itemPos.y
hero.moveXY(itemX, itemY)

You haven’t changed it:

thank you sooooooooooooooo much :smiley:

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