Multiplayer treasure grove (Python) no bug, but character just freezes

Can anyone help explain why my character just moves to the red x and then never attacks the enemy or grabs any coins. I have also made up some more complex code using the distanceTO function and using logic of distanceToItem vs distanceToEnemy but that didn’t work either.

Be the first to 100 gold!

If you are defeated, you will respawn at 67% gold.

enemy = hero.findNearestEnemy()
item = hero.findNearestItem()
flag = hero.findFlag()

while True:
# Find coins and/or attack the enemy.
# Use flags and your special moves to win!
if item:
hero.moveXY(item.pos.x, item.pos.y)


Are you sure that you hero sees an enemy?

1 Like