Sarven-sentry help

My hero doesn’t find any flag…

while True:
    flagGreen = hero.findFlag("green")
    flagBlack = hero.findFlag("black")

    if flagGreen:
        # Build a "fence" at flagGreen's position.
        hero.buildXY("fence", flagGreen.pos.x, flagGreen.pos.y)
        hero.pickUpFlag(flagGreen)

    if flagBlack:
        # Build a "fire-trap" at flagBlack's position.
        hero.buildXY("fire-trap", flagBlack.pos.x, flagBlack.pos.y)
        hero.pickUpFlag(flagBlack)

    hero.moveXY(43, 31)

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

Your code works fine for me. Are you actually placing the flags where they tell you to?

1 Like

And you do realize that you have to submit it in order to use flags?