So I can’t figure out what is wrong in my code. When the potion is thrown my character doesn’t move and the munchkin gets the water and slaughters the hero and Omarn.
# Race munchkins to the water distilled by Omarn Brewstone!
# The continue statement is powerful for managing complicated logic.
# When the program uses the continue statement, the rest of the loop is skipped.
# However, unlike with "break", the loop repeats instead of stopping.
# Use "continue" to verify the conditions of the ambush.
while True:
enemy = hero.findNearestEnemy()
item = hero.findNearestItem()
# If there is no enemy, continue out of the loop.
if not enemy:
continue
# If there is an enemy, but no item, ask for a potion and continue out of the loop.
if not item:
hero.say("Give me a drink!")
continue
# Use an if-statement to check the item's type. If the type is "poison", continue out of the loop.
if item.type is poison:
continue
else:
hero.moveXY(44, 36)
hero.moveXY(34, 47)
# If it is not, the potion must be a bottle of water, so walk to it and return to the starting position!