Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Useful competitors issue

Hey guys, Im having trouble with the useful competitor level.I think it has a bug. Its not letting me retrieve the last coin.Also it has a gem in there which my player retrieves, but it leaves the last coin.My code is-

while True:
enemy = hero.findNearestEnemy()
if enemy:
# Attack the enemy only if the type is NOT equal to “peon”.
if enemy.type != “peon”:
hero.attack(enemy)

item = hero.findNearestItem()

 # Gather the item only if the type is NOT equal to "poison".
if item and item.type != "poison":

        itemPos=item.pos
        itemX=item.pos.x
        itemY=item.pos.y
        hero.moveXY(itemX,itemY)

Hi @Mr.Wezi, welcome to the discourse.
You’re code is correct, please could you post a screenshot of the level screen, you equipment.
Thanks
Danny

Hey Danny. Thanks a lot for your help. Fortunately the next day it worked,I guess there was a glitch at that time. But again thank you.