# Gather coins to summon soldiers and have them attack the enemy
loop:
items = self.findItems()
item = self.findNearest(items)
itemPos = item.pos
x = itemPos.x
y = itemPos.y
# Move to the nearest coin.
# Use move instead of moveXY so you can command constantly.
self.moveXY(x, y)
# If you have funds for a soldier, summon one.
if self.gold > self.costOf("soldier"):
self.summon("soldier")
enemies = self.findEnemies()
enemy = self.findNearest(enemies)
if enemy:
# Loop over all your soldiers and order them to attack.
soldiers = self.findFriends()
soldierIndex += 1
soldier = soldiers[soldierIndex]
soldierIndex += 1
myList = [5, 6, 7]
# Use the 'attack' command to make your soldiers attack.
#self.command(soldier, "attack", enemy)
for soldier in soldiers:
self.command(soldier, "attack", enemy)
Is this right? Because it still doesn’t work