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

[SOLVED]The two flowers help

I cant seem to beat this level
here is my cade

# If the peasant is damaged, the flowers will shrink!
enemy = hero.findNearestEnemy()
def summonSoldiers():
    if hero.gold >= hero.costOf("soldier"):
        hero.summon("soldier")
# Define the function: commandSoldiers
def commandSoldiers():
    soldiers = hero.findByType("soldier")
    for soldier in soldiers:
        hero.command(soldier, "defend", peasant)
        if enemy:
            hero.command(soldier, "attack", enemy)
        # Define the function: pickUpNearestCoin
def pickUpNearestCoin():
    items = hero.findItems()
    for item in items:
        coin = hero.findNearestItem()
        hero.move(coin.pos)
def attack():
    if enemy:
        hero.attack(enemy)
peasant = hero.findByType("peasant")[0]
def cleave():
    if hero.isReady("cleave"):
        hero.move(hero.pos)
        hero.cleave(enemy)

while True:
    attack()
    cleave()
    summonSoldiers()
    # commandSoldiers()
    commandSoldiers()
    # pickUpNearestCoin()
    pickUpNearestCoin()


for pickUpNearest Coin if you have thornprick just do
friend = hero.findFriends()
hero.move(friend.pos)
eventually you will cram the peasant in to the forest he won’t get hurt because your covering him and the flowers will grow. Note: you would have to submit a few times until it works

so put on thronpick and do that?

and delete pickupnearetcoin?

good i got it thanks

your welcome and good luck

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