# Follow me on youtube channel Phy Tu
# Help with programming on Python, school math, physics
# https://www.youtube.com/channel/UCP5ycahCEZ24qmRRgNnko5Q
# Destroy mechs and collect gold from them.
coinNumber=0
while True:
coin = hero.findNearest(hero.findItems())
# While a coin exists:
while coin:
# Move to the coin.
hero.moveXY(coin.pos.x,coin.pos.y)
coin = hero.findNearest(hero.findItems())
# Reassign the coin variable to the nearest item.
coinNumber+=1
enemy = hero.findNearestEnemy()
if enemy:
# While enemy's health is greater than 0.
while enemy.health>0:
# Attack enemy.
hero.attack(enemy)
pass