def onSpawn(event):
# 派遣宠物绕地牢找寻:
coin = pet.findNearestByType(“gold-coin”)
if coin:
hero.say(“hello”)
pet.moveXY(coin.pos.x, coin.pos.y)
pet.fetch(coin)
# 别忘了把它返还给英雄:
pet.moveXY(hero.pos.x, hero.pos.y)
pass
pet.on(“spawn”, onSpawn)
while True:
# Guard peasants:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
# 当你有300 +金币移动到红色标记:
if hero.gold >= 300:
hero.moveXY(50, 34)
pass