I just started it an im confused
Can you show me your code?
Andrei
defendPoints = [{"x": 35, "y": 63},{"x": 61, "y": 63},{"x": 32, "y": 26},{"x": 64, "y": 26}]
summonTypes = ["soldier","soldier","soldier","soldier","archer","archer","archer","archer"]
# You start with 360 gold to build a mixture of soldiers and archers.
# self.built is an array of the troops you have built, ever.
# Here we use "len(self.built) % len(summonTypes)" to wrap around the summonTypes array
def summonTroops():
type = summonTypes[len(hero.built) % len(summonTypes)]
if hero.gold >= hero.costOf(type):
hero.summon(type)
def commandTroops():
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
# Use % to wrap around defendPoints based on friendIndex
# Command your minion to defend the defendPoint
while True:
summonTroops()
commandTroops()
# Use % to wrap around defendPoints based on friendIndex
# Command your minion to defend the defendPoint
I don’t understand this
After this put something like this:
posd = defendPoints[i%len(defendPoints)]
And after that command your friend to defend the posd position.
Andrei
ok done that one whats next
Can I see the code?
Andrei
defendPoints = [{"x": 35, "y": 63},{"x": 61, "y": 63},{"x": 32, "y": 26},{"x": 64, "y": 26}]
summonTypes = ["soldier","soldier","soldier","soldier","archer","archer","archer","archer"]
# You start with 360 gold to build a mixture of soldiers and archers.
# self.built is an array of the troops you have built, ever.
# Here we use "len(self.built) % len(summonTypes)" to wrap around the summonTypes array
def summonTroops():
type = summonTypes[len(hero.built) % len(summonTypes)]
if hero.gold >= hero.costOf(type):
hero.summon(type)
def commandTroops():
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
# Use % to wrap around defendPoints based on friendIndex
posd = defendPoints[i%len(defendPoints)]
# Command your minion to defend the defendPoint
while True:
summonTroops()
commandTroops()

hello are you still there Andrei
After this command the friend to defend the posd.
Andrei
Have you completed the level, @liam_cutts? If not, try to send me your recent code.
Andrei
no I haven’t done it yet
Can I see your code?
Andrei
can you show me the code to make then defend
Here it is:
hero.command(friend, "defend", posd)
Andrei
Have you completed the level?
Andrei
no my soldiers die still
no
Try resummiting, maybe it was just an unlucky seed.
Andrei
And can you delete this code because it is a working code?
Andrei
ok its done now thanks