I gave up on the warrior, as the other warrior just ties me and he has a bigger army. I have been trying it with the archer. No matter what I do, I can never win. And half the time a yak walks in front of my arrows and then kills me, but even when that doesn’t happen I still lose. Here is my code, is runs fine but isn’t good enough. Anyone have some suggestions?
loop: enemies = self.findEnemies() enemyIndex = 0 # Make an array of all enemies. while enemyIndex < len(enemies): currentTarget = enemies[enemyIndex] enemyIndex += 1 distance = self.distanceTo(currentTarget) # If it's a sand-yak, move to next enemy in the array. if currentTarget.type is "sand-yak": pass # If it's out of range, move to the next enemy in the array. elif distance > 37: pass # Else, we target it. elif currentTarget.health > 0: # If it's too close, move back. if distance < 18: self.moveXY(self.pos.x - 15, self.pos.y) # Else, we attack it. else: self.attack(currentTarget)