Sarven Sentry Python Help!


#1

I have been trying to figure out how to beat this level for some time now. Any help? Here is my code:

`
while True:
flagGreen = hero.findFlag(“green”)
flagBlack = hero.findFlag(“black”)
fbx = flagBlack.pos.x
fby = flagBlack.pos.y

# If there's a flagGreen...
if flagGreen:
    
    # Build a fence at flagGreen's position.
    self.buildXY("fence", fgx, fgy)
    self.pickUpFlag(flagGreen)
if flagBlack:
    self.buildXY("fire-trap", fbx, fby)
    self.pickUpFlag(flagBlack)
hero.moveXY(43, 31)

`
Please help me if you can.


#2

for starters, you haven’t defined fgx or fgy.


#3

Yes, @MunkeyShynes is right you need yo define what fbx or fly is before using them. other than that you look about right on.