I keep dying in this level please help
here is my code:
while True:
enemy = hero.findNearestEnemy()
distance = hero.distanceTo(enemy)
friends = hero.findFriends()
if hero.gold > hero.costOf("archer"):
hero.summon("soldier")
for friend in friends:
hero.command(friend, "attack", enemy)
if enemy and distance < 10:
hero.attack(enemy)
if enemy and distance < 5:
hero.shield()
Check your names…
You might also want to make your friends attack their nearest enemy rather than your nearest enemy because otherwise they all attack the same enemy which is very innefficient.
Danny
while True:
friends = hero.findFriends()
if hero.gold > hero.costOf("archer"):
hero.summon("archer")
for friend in friends:
enemy = friend.findNearestEnemy()
hero.command(friend, "attack", enemy)
if enemy:
distance = hero.distanceTo(enemy)
if enemy and distance < 10:
hero.attack(enemy)
if enemy and distance < 5:
hero.shield()
while True:
friends = hero.findFriends()
item = hero.findNearestItem()
if item:
hero.move(item.pos)
if hero.gold > hero.costOf("archer"):
hero.summon("archer")
for friend in friends:
enemy = friend.findNearestEnemy()
hero.command(friend, "attack", enemy)
if enemy:
distance = hero.distanceTo(enemy)
if enemy and distance < 10:
hero.attack(enemy)
if enemy and distance < 5:
hero.shield()
Is that because you are using a chromebook (or similar)? You should still have a “PRT SC” button. This will take a screen shot and store it in your clipboard. You can also do “Alt-PRT SC” to capture a pic of the selected app.
If you are using a chromebook, do control+shift+the rectangle button with two lines after it (above the 6) (because i don’t know what it is called). then click and drag for the selected area for the picture.