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

Cloudrip Brawl 3

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()
1 Like

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

1 Like

Why did you close my topic

Not him. @system closed it and @Deadpool198 opened it again.

Andrei

Oh OK :smiley: :smiley:

1 Like

Do you need any more advice?

Andrei

Yeah I still haven’t finished

Can you show me your recent code?

Andrei

here:

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()

Try to put that outside of this if starement

Andrei

nope i die after 54s not 60
here is my code:

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()

Try to only collect gold with the hero and let the combat to your minions, but only shield when you are low on health.

Andrei

Now i die in 50s
here is my code:

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 hero.health < 200:
        hero.shield()

Can you show me equipment?

Andrei

sorry can’t :neutral_face:

Oh, ok. Then try to summon soldiers instead of archers.

Andrei

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.

2 Likes

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.

2 Likes

1 Like

Try to do more levels and buy better armour (or the speed ring) and you will complete the level.

Andrei