Bait and switch (python) help pls

its confusing but i followed the instructions

Lure ogres into traps with decoys.

This function has the hero collect gold until they have enoughGold.

def collectUntil(enoughGold):

While hero.gold is less than enoughGold:

item = hero.findNearestItem()

while hero.gold < enoughGold:
    # Find a coin and take it: 
    if item:
        hero.moveXY(item.pos.x, item.pos.y)
pass

Collect 25 gold for one decoy and build it on the red mark.

collectUntil(25)
hero.buildXY(“decoy”, 40, 52)

It’s better to hide.

hero.moveXY(20, 52)

Use the collectUntil function to collect 50 gold:

collectUntil(50)

Build a “decoy” on the bone mark:

hero.buildXY(“decoy”, 68, 22)

Build a “decoy” on the wooden mark:

hero.buildXY(“decoy”, 30, 20)

i fixed it i had to put the while statement before

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