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

[SOLVED] Cloudrip Commander help please [python]

What is that for? What is it’s like place in the code.

should i take it out?

What I mean is what is its use in the code?

to move the ogres away from me

Is that part of the code working?

You need for loop to let your soldier move .
:yum:
var friends = hero.findNearestFriend( );
for(var i = 0;i<friends.length;i++){
var friend = friends[i];
hero.command(friend,“move”,{x:53,y:40})
}

1 Like

what’s wrong here

# Summon some soldiers, then direct them to your base.

# Each soldier costs 20 gold.
while hero.gold > hero.costOf("soldier"):
    hero.summon("soldier")
    
soldiers = hero.findFriends()
soldierIndex = 0
soldierIndex = 1
soldierIndex = 2
soldierIndex = 3
soldierIndex = 4
soldierIndex = 5
# Add a while loop to command all the soldiers.
while True:
    soldier = soldiers[soldierIndex]
    hero.command(soldier, "move", {"x": 50, "y": 40})

# Go join your comrades!
hero.moveXY(51, 41)

What do those lines do in your code?

Why do you command only one soldier to move?

Andrei

I finished it I fixed it

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.