CodeCombat(极客战记)去拿取代码-python

CodeCombat(极客战记)去拿取代码-python

CodeCombat地址
https://codecombat.cn/https://codecombat.163.com/


这里写图片描述

# 你被困在了陷阱中!
# 派遣宠物拿取治疗药水!
def goFetch():
    # 你可以在处理函数中使用循环。
    while True:
        potion = hero.findNearestItem()
        if potion:
            # 用 “pet.fetch()” 去让你的宠物捡药水:
            pet.fetch(potion)
            pass
# 当宠物被召唤出来时,会触发 "spawn" 事件。
# 这让你的宠物在关卡开始时运行 goFetch()函数。
pet.trick()
pet.on("spawn", goFetch)

猜你喜欢

转载自blog.csdn.net/hqj_email/article/details/81543392