def pickUpCoin():
hero.toggleFlowers(False)
while True:
coin = hero.findNearestItem()
hero.move(coin.pos)
pass
def summonTroops():
if hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
pass
def commandSoldier(friend):
friends = hero.findFriends()
enemy = friend.findNearestEnemy()
if enemy :
hero.command(friend, "attack", enemy)
pass
def commandArchers(friend):
friends = hero.findFriends()
enemy = friend.findNearestEnemy()
if enemy and friend.distanceTo(enemy) < 25:
hero.command(friend, "attack", enemy)
else:
hero.command(friend, "move", {"x":friend.pos.x, "y":frien.pos.y})
pickUpCoin()
summonTroops()
friends = hero.findFriends()
for friend in friends:
if friend.type == "soldier":
commandSoldier(friend)
elif friend.type == "archer":
commandArchers(friends)
pass
sorry about that i couldn’t send any more. it still does the same thing though
You did not remove it!
1 Like
i beat the level. thanks a lot AnseDra!
i even managed to get the bonus of no-one dying : )
No problem! Glad I could help! And congratulations!
1 Like