Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[Solved] I'm stuck on cloud rip commander

#1

my game sase that the code works and there’s nothing wrong with it but it won’t work hears my code

while hero.gold > hero.costOf("soldier"):
    hero.summon("soldier")
soldiers = hero.findFriends() 
soldierIndex = 0
while (soldierIndex < len(soldiers)):
    hero.command(soldiers, "move", {"x":50, "y":40})
hero.moveXY(50, 40)
1 Like
#2

Your while-loop is not increasing the soldierIndex, so you end up with an infinite loop.

2 Likes
#3

still not working it sase that Comand’s argumant minyon should have type until but got aray

#4

hero.command(soldiers, “move”, {“x”:50, “y”:40})

soldiers is array, unit is soldiers[soldierIndex]

3 Likes
#5

thanks it wors now! i realis how someonmd can get that wrong