Help with Drop the Flag? ;~;


#1

I’ve been stuck on this level for a while now, any help with it? ^^;

loop:
    flag = self.findFlag()
    if flag:
        fx = self.findFlag()
        fy = self.findFlag()
        
        self.buildXY("fire-trap", fx, fy)
        self.pickUpFlag(flag)
    else:
        item = self.findNearestItem()
        if item:
            pos = item.pos
            itemX = pos.x
            itemY = pos.y
            self.moveXY(itemX, itemY)

#2

When you are trying to set fx and fy you will need to look at the flag.pos.x and flag.pos.y Does that help?


#3

Exactly as matt said. your flag code is incorrect

flag = self.findFlag()
if flag:
    self.buildXY("fire-trap", flag.pos.x, flag.pos.y)
    self.pickUpFlag(flag)
else:
    item = self.findNearestItem()
    if item:
        self.moveXY(item.pos.x, item.pos.y)

#4

Thank you so much ^-^