Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[Solved] Drop the Flag in Forest


Hey guys i need help with my code for this if you can help PLEASE DO. im using Python

while True:
    flag = self.findFlag()
    if flag:
        # How do we get fx and fy from the flag's pos?
        flagpos = flag.pos
        fx = pos.x
        fy = pos.y
        self.buildXY("fire-trap", fx, fy)
        item = self.findNearestItem()
        if item:
            pos = item.pos
            itemX = pos.x
            itemY = pos.y
            self.moveXY(itemX, itemY)```

You’ve not properly defined fx and fy. Hint: Immediately above it you define, flagpos, but never use this variable.

1 Like

ohh ok thx i will fix that. THX SO MUCH

1 Like

you can also say “self.buildXY(“fire-trap”, flag.pos.x, flag.pos.y)”

1 Like