Mad maxer please help! [SOLVED]


hello guys sorry for the repetive posting but now mad maxer is making me get stuck heres the code the problem is that my hero won’t move and my code is correct what is happening???

while True:
    farthest = None
    maxDistance = 0
    enemyIndex = 0
    enemies = hero.findEnemies()
    # Look at all the enemies to figure out which one is farthest away.
    while enemyIndex < len(enemies):
        target = enemies[enemyIndex]
        enemyIndex += 1
        # Is this enemy farther than the farthest we've seen so far?
        distance = hero.distanceTo(target)
        if distance > maxDistance:
            maxDistance = distance
            farthest = target
    if farthest:
        # Take out the farthest enemy!
        # Keep attacking the enemy while its health is greater than 0.
        if enemy.helath>0:


Typo here. Health instead of helath


okay thanks i’ll try that


it was so close to working then the throwers came along and killed me because my hero kept on attacking the decoys


You have to attack farthest not enemy


okay i’ll try that also


yesssssssss thank you it worked :grinning::grinning::grinning::crossed_swords::crossed_swords::crossed_swords:


Just saying but if your code doesn’t work then don’t say your code is correct (I got confused for a sec)

Also don’t spam and stuff @guy_oy

Felt the need to point that out sry Chaboi