[SOLVED] The Two Flowers(python)

My code isn’t working… can someone look it over for me?


# If the peasant is damaged, the flowers will shrink!
def summonSoldiers():
    if hero.gold >= hero.costOf("soldier"):
# Define the function: commandSoldiers
def commandSoldiers():
    soldiers = hero.findByType("soldier")
    for soldier in soldiers:   
        enemies = soldier.findEnemies()
        enemy = soldier.findNearestEnemy(enemies)
        hero.command(soldier, "attack", enemy)
# Define the function: pickUpNearestCoin
def pickUpNearestCoin():
    item = hero.findNearestItem()
    if item:
peasant = hero.findByType("peasant")[0]
while True:
    # commandSoldiers()
    # pickUpNearestCoin()
1 Like

What happens when you run your code? :3

1 Like

Hehe, i looked more closely at the error ducky, and it said no argument needed for findNearestEnenmy. so i took the enemies argument off, and it works!
Sry, no more help needed.

@Deadpool198 should i delete my code?

le * whine * okay Good job :3


I think it’s alright because it’s not fully functioning.

It’s not @Deadpool198 ?

Lol its funny that you gave yourself the solution lol @CocoCharlie

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