Im playing the Clouddrip Brawl, where I have to summon many soldiers to attack many enemies. However I have found some problems along the way:
1.-My soldiers stop atacking after one kill, they just stand still. Then it is like I have to walk near them to revive them.
2.-My soldiers attack different enemies (many soldiers die, few enemies die). It would be much more effective if they all attack one single enemy.
3.-Sometimes, a soldier is attacking an enemy, enemy is not dead and soldier starts attacking another enemy.
Here is my code, thanks for the help:
loop:
enemies = self.findEnemies()
enemy = self.findNearest(enemies)
coins = self.findItems()
coin = self.findNearest(coins)
friends = self.findFriends()
friend = self.findNearest(friends)
if coin:
self.move(coin.pos)
if self.gold > 20:
self.summon("soldier")
if enemy:
self.command(friend, "attack", enemy)
if enemy:
self.command(friend, "attack", enemy)