Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Sarven Sentry Python Help!


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)
if flagBlack:
    self.buildXY("fire-trap", fbx, fby)
hero.moveXY(43, 31)

Please help me if you can.


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


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