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)