it says there is an error
here is my code:
summonTypes =
def summonTroops():
type = summonTypes[len(hero.built) % len(summonTypes)]
if(hero.costOf(type) <= hero.gold):
hero.summon(type)
def gatherCoins():
items = hero.findItems()
item = hero.findNearest(items)
if item:
hero.move(item.pos)
def commandTroops():
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, “attack”, enemy)
while True:
summonTroops()
gatherCoins()
commandTroops()
plz help…
Can you format your code as it is described below so we will be able to help you at this level?
Andrei
1 Like
summonTypes =
def summonTroops():
type = summonTypes[len(hero.built) % len(summonTypes)]
if(hero.costOf(type) <= hero.gold):
hero.summon(type)
def gatherCoins():
items = hero.findItems()
item = hero.findNearest(items)
if item:
hero.move(item.pos)
def commandTroops():
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, “attack”, enemy)
while True:
summonTroops()
gatherCoins()
commandTroops()``
summonTypes = []
def summonTroops():
type = summonTypes[len(hero.built) % len(summonTypes)]
if(hero.costOf(type) <= hero.gold):
hero.summon(type)
def gatherCoins():
items = hero.findItems()
item = hero.findNearest(items)
if item:
hero.move(item.pos)
def commandTroops():
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
while True:
summonTroops()
gatherCoins()
commandTroops()
1 Like
Here put the types of units that you want to summon.
Andrei
Can you show us your recent code?
Andrei
Then congratulations for completing the level! 
Andrei
2 Likes
system
Closed
14
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.