# Follow me on youtube channel Phy Tu
# Help with programming on Python, school math, physics
# https://www.youtube.com/channel/UCP5ycahCEZ24qmRRgNnko5Q
# 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:
while hero.gold<enoughGold:
coin=hero.findNearestItem()
# Find a coin and take it:
hero.moveXY(coin.pos.x,coin.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.moveXY(68,43)
hero.moveXY(71,30)
hero.buildXY("decoy",48,22)
# Build a "decoy" on the wooden mark:
hero.buildXY("decoy",30,20)