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

Help on the decoy drill

this us my code

# Build 4 decoys, then report the total to Naria.

decoysBuilt = 0
while True:
    coin = hero.findNearestItem()
    
    if coin:
        # Collect the coin!
        coin = hero.findNearestItem()
        hero.moveXY(coin.pos.x, coin.pos.y)
        pass
    # Each decoy costs 25 gold.
    # If hero.gold is greater than or equal to 25:
    if hero.gold >= 25:
        
        # buildXY a "decoy"
        hero.buildXY("decoy", 53, 32)
        # Add 1 to the decoysBuilt count.
        
    if decoysBuilt == 4:
        # Break out of the loop when you have built 4.
        break
        pass
    
hero.say("Done building decoys!")
hero.moveXY(14, 36)
# Say how many decoys you built.
hero.say(decoysBuilt)

Missing one line of code… # Add 1 to the decoysBuilt count.

1 Like

brooksy125 means to add decoysBuilt += 1 to your code and that will add +1 to your counter (decoysBuilt) each time you build a decoy.

(I can’t find this level anywhere on my maps (although I really remember playing it :thinking:)

thank you (20 characters)