Hi, I was working on my code and ran into a small problem.
Here is my code
# Put flags where you want to build traps.
# When you're not building traps, pick up coins!
while True:
flag = hero.findFlag()
if flag:
# How do we get flagX and flagY from the flag's pos?
# (Look below at how to get x and y from items.)
self.buildXY("fire-trap", 30, 45)
self.buildXY("fire-trap", 30, 31)
self.buildXY("fire-trap", 30, 16)
hero.buildXY("fire-trap", flagX, flagY)
hero.pickUpFlag(flag)
else:
item = hero.findNearestItem()
if item:
itemPos = item.pos
itemX = itemPos.x
itemY = itemPos.y
hero.moveXY(itemX, itemY)
Here is a screenshot