ZadonX
September 25, 2015, 6:00pm
1
while self.gold > self.costOf("soldier"):
self.summon("soldier")
friends = self.findFriends()
friendIndex = 0
friend = friends[friendIndex]
while friendIndex < len(friends):
# Do stuff
# Add a while loop to command all the soldiers.
soldiers = self.findFriends()
soldierIndex = 0
soldier = soldiers[soldierIndex]
self.command(soldier, "move", {"x": 50, "y": 40})
friendIndex += 1
please help i’m really stuck
while self.gold > self.costOf("soldier"):
self.summon("soldier")
friends = self.findFriends()
friendIndex = 0
friend = friends[friendIndex]
while friendIndex < len(friends):
# Do stuff
# Add a while loop to command all the soldiers.
soldiers = self.findFriends()
soldierIndex = 0
soldier = soldiers[soldierIndex]
self.command(soldier, "move", {"x": 50, "y": 40})
self.moveXY(50, 40)
I only command 1 Soldier. PLEASE HELP
You need to increment your friendIndex after each command. You should also move your self.moveXY out of the while loop.
What do you mean? How to increment? My code moves 2 soldiers, but still…
1 Like
Just move to the X first, before you summon your soldiers
Thank’s a lot, you helped me,too
thanks a lot you have just got me out of a
huuuuuuuge jam
Hi @Speedypickle1 , welcome to the CodeCombat discourse!
Thanks for your comment, but would it be alright if you could not post on old Level Help topics unless your need help yourself.
The Like button is a good way to say thanks.
I meant to say this to @Anonym too.
Danny