Useful Competitors - Bug?


#1

I don’t know if this is a bug or not but when I run my code everything runs fine. My problem is that when my char goes to pick up the last coin I run out of time right when he’s about to pick it up… Is there an option to change the time limit or what am I doing wrong?


#2

Here’s my code if anyone needs it…

while True:
enemy = hero.findNearestEnemy()
if enemy:
if enemy.type != “peon”:
hero.attack(enemy)
item = hero.findNearestItem()
if item:
itemx = item.pos.x
itemy = item.pos.y
if item.type != “poison”:
hero.moveXY(itemx, itemy)
pass


#3

Try using a faster boot or hero.


#4

which world is this in?
also, please use ctrl + shift + c to format your code so it looks nicer.! :grinning:
Example:

while True:
    enemies = hero.findEnemies()
    item = hero.findNearestItem()
    if len(enemies) > 0:
        for enemy in enemies:
            if enemy.type != "peon" and hero.distanceTo(enemy) < 25:
                while enemy.health > 0:
                    hero.attack(enemy)
    if item and item.type!= "poison":
        hero.move(item.pos)