codecombat Darkhoppe代码攻略

关键在if hero.isReady(“blink”) and item:一定要加and item因为BLINK功能有1秒等待,如果没有if hero.isReady(“blink”) and item这样写,就回报item.pos没有定义或者接收到空字符
在这里插入图片描述

# Collect 10 gems.

# Use "blink" ability to teleport between gaps.
while True:
    item= hero.findNearestItem()
    # hero.blink(Vector(x, y))
    # hero.blink(thing.pos)
    if hero.isReady("blink") and item:
        hero.blink(item.pos)
    pass

猜你喜欢

转载自blog.csdn.net/weixin_42861040/article/details/83386117