Here is the relevant code. After this it goes into if nearest: and attacking while health > 0. As far as I can tell, my less than/more thans are pointing the right way, but it keeps going for far off throwers instead of the swarm of munchkins around it. Where am I missing something?
loop: enemies = self.findEnemies() enemyIndex = 0 #edited to add to post but was already in code nearest = None nearDistance = 9999 while enemyIndex < len(enemies): enemy = enemies[enemyIndex] if enemy: distance = self.distanceTo(enemy) if distance < nearDistance: nearest = enemy nearDistance = distance enemyIndex = enemyIndex +1