enemy = hero.findNearestEnemy() def shouldRun(): if hero.health < hero.maxHealth / 2: return True else: return False while True: # Move to the X only if shouldRun() returns True if shouldRun() == True: hero.moveXY(75, 37) # Else, attack! else: hero.attack(enemy)
im using this code, if shouldrun gives back True then move to the coordinates, if not attack. When i press play the character doesn’t even attack. He’s just standing there doing nothing.
I don’t know why but writing this post the spaces are included in the code ( with the if command) but not when i click on post thread. just an FYI