[SOLVED] Timber Guard help please

Anytime! And congratulations for completing the level! :partying_face:

uuummm… nvm @AnSeDra i eather get a rly bad seed every time a hit submit or something else

1 Like

:frowning: :cry: (20)

1 Like

So have you finished the level or not, @098765432123?

hey @AnSeDra sry for the late response i hade to do something

1 Like

but do u need a sword?

1 Like

No, you do not. Have you completed the level?

no ( 20 characters )

1 Like

here is my current code

while True:
    gold=hero.findNearestItem()
    if gold:
        hero.moveXY(gold.pos.x, gold.pos.y)
    # If you have enough gold, summon a soldier.
    if hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")
        # Use a for-loop to command each soldier.
        # For loops have two parts: "for X in Y"
        # Y is the array to loop over.
        # The loop will run once for each item in Y, with X set  the current item.
    for friend in hero.findFriends():
        if friend.type == "soldier":
            enemy = friend.findNearestEnemy()
            defendPos = {"x": 78, "y": 37}
            # If there's an enemy, command her to attack.
            # Otherwise, move her to the right side of the map.
            if enemy:
                hero.command(friend, "attack", enemy)
            else:
                hero.command(friend, "move", defendPos)

1 Like

i have messed around with the move and now the enemy gets there to quick

1 Like

Here try to use move instead of moveXY. Do you need any more assistance at this level?

my hero dosent move now

1 Like

Can you show me your code?

so i need moveXY or else my hero dosent move

1 Like
while True:
    gold=hero.findNearestItem()
    if gold:
        hero.move(gold.pos.x, gold.pos.y)
    # If you have enough gold, summon a soldier.
    if hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")
        # Use a for-loop to command each soldier.
        # For loops have two parts: "for X in Y"
        # Y is the array to loop over.
        # The loop will run once for each item in Y, with X set  the current item.
    for friend in hero.findFriends():
        if friend.type == "soldier":
            enemy = friend.findNearestEnemy()
            defendPos = {"x": 78, "y": 37}
            # If there's an enemy, command her to attack.
            # Otherwise, move her to the right side of the map.
            if enemy:
                hero.command(friend, "attack", enemy)
            else:
                hero.command(friend, "move", defendPos)

1 Like

Here put

hero.move(gold.pos)

Do you need any more assistance at this level?

that dosent do anything

1 Like

i need to identify a specific type of coin if i do that

1 Like

Try again. And put gold instead of coin.
Do you need any more assistance at this level?

i passed! :partying_face: (i didnt answer till i hit submit)

2 Likes