i have been stuck on this level for a long time. I can’t figure out what is wrong in my code.
# Put flags where you want to build traps.
# When you're not building traps, pick up coins!
loop:
flag = self.findFlag()
if flag:
# How do we get fx and fy from the flag's pos?
# (Look below at how to get x and y from items.)
self.buildXY("fire-trap", fx, fy)
self.pickUpFlag(flag)
else:
item = self.findNearestItem()
if item:
itemPos = item.pos
itemX = itemPos.x
itemY = itemPos.y
self.moveXY(itemX, itemY)
topenemy = self.findNearestEnemy()
bottomenemy = self.findNearestEnemy()
rightenemy = self.findNearestEnemy()
if topenemy:
self.buildXY("fire-trap", 30, 45)
if bottomenemy:
self.buildXY("fire-trap", 30, 16)
if rightenemy:
self.buildXY("fire-trap", 30, 31)
can someon please tell me what i am doing wrong. Thx
Correct.
You happily collect all the coins. From time to time, an ogre will come along. You use your flag to place a fire-trap, and then continue to collect the coins. After some time, all ogres are defeated.
Please post your code and state the difficulty you’re having. Also, state any errors you’re receiving. We can’t help you if we don’t know what the problem is.
Please place assistance requests in the correct thread. You are requesting assistance with the level, Mind The Trap, in the thread for, Drop The Flag. If we all did this, this board would be a complete mess. Please either revive a previous thread for Mind The Trap or create a new one. Thank you.