i cant move to the items in this level how do i do that? and this is python
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!
# If the item’s type is “gem” or “coin”:
if item.type == “gem” or item.type == “coin”:
distance = hero.distanceTo(item)
# Then move and pick it up:
hero.move()
i tried to do hero.move(item) and hero.moveTo(item)
Please, format all your code properly, as we might not be able to help
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!
# If the item’s type is “gem” or “coin”:
if item.type == “gem” or item.type == “coin”:
distance = hero.distanceTo(item)
# Then move and pick it up:
hero.move()
Based on which boots you have, the methods can differ. But commonly, you can use: hero.moveXY(x, y)
and the x and y in this case should be the item’s pos.x and pos.y
Hope this helps
You can do hero.moveXY(item.pos.x,item.pos.y)
or you can do hero.move(item.pos)
. I would recommend the first one, as it is the intended method to move to the coin.