Below is my code. I’ll admit I’m working a little over my head here but it has me perplexed and I was hoping to have discussion about it and possibly learn.
loop: enemies = self.findEnemies() enemyIndex = 0 # Devise your own strategy. Be creative! if enemies: enemyDistance = self.distanceTo(self.findNearest(enemies)) while enemyIndex < len(enemies): # enemy = enemies[enemyIndex] # while enemyDistance: # self.attack(enemy) # if len(enemies) >= 2 and enemyDistance < 10: # self.cleave(enemy) # else: # self.attack(enemy) # while len(enemies) == 0: # self.moveXY(49, 62) # self.shield()
So what I think i am doing here is…build an index of enemies that my guy can see… if he sees enemies, set the distance to the variable…verifying that there are enemies by checking the number of enemies. This is where it breaks. I’ve commented out the rest of what I had going on.