Hi folks, I’d appreciate some help on this one - not sure how to categorize it because it could be a bug or my code.
My hero defeats a bunch of ogres and avoids all poison, until the very end - a poison spawns right between her and the nearest ogre so she runs right into it on her way over to him. How can I fix this? Here’s my code:
# Ogres are attacking a nearby settlement! # Be careful, though, for the ogres have sown the ground with poison. # Gather coins and defeat the ogres, but avoid the burls and poison! while True: enemy = hero.findNearestEnemy() if enemy.type == "munchkin" or enemy.type == "thrower": hero.attack(enemy) item = hero.findNearestItem() # Check the item type to make sure the hero doesn't pick up poison! # Look for types: 'gem' and 'coin' if item.type == "gem" or item.type == "coin": hero.moveXY(item.pos.x, item.pos.y)
Thanks in advance!