Ok so i got the code, and it works, but instead of placing a fire trap where i put the flag, he just picks the flag up and continues with collecting the coins. heres my code:
while True:
flag = self.findFlag()
if flag:
if flag.colour is "black":
self.buildXY("fire-trap", flag.pos.x, flag.pos.y)
self.pickUpFlag(flag)
else:
item = self.findNearestItem()
if item:
itemPos = item.pos
itemX = itemPos.x
itemY = itemPos.y
self.moveXY(itemX, itemY)
If anyone can tell me where i went wrong it would be much appreciated.
Hello, Rhys, and welcome. Please read the FAQ before you post again, to learn how to properly format you code. I have done it for you this time, but do so yourself in the future.
Perhaps you aren’t using a black flag? That might explain it.