zoukankan      html  css  js  c++  java
  • 「网易官方」极客战记(codecombat)攻略-沙漠-钥匙陷阱-key-traps

    (点击图片进入关卡)

    这些钥匙是如此近,但不要急于亲自拿。

    简介

    你必须释放圣骑士。要做到这一点,你需要三个钥匙。

    使用你的宠物来获得这些钥匙。 不要试图用你的英雄收集他们。

    默认代码

    # 获得三把钥匙并释放圣骑士。
    def onSpawn(event):
        # 宠物需要找到并拿回3个钥匙。
        # 您需要下一个类型的物品:
        # "bronze-key", "silver-key"和 "gold-key"

     

    pet.on("spawn", onSpawn)
    while True:
        enemy = hero.findNearestEnemy()
        if enemy and enemy.team == "ogres":
            hero.attack(enemy)
        if hero.health < 300:
            # 你也可以在主线程中使用宠物
            potion = pet.findNearestByType("potion")
            if potion:
                hero.moveXY(potion.pos.x, potion.pos.y)

    概览

    你已经掌握了最近这个关卡所需的技能。 如果您在这个关卡遇到问题,请尝试返回并重新掌握您的技能。

    注意物品类型和拼写错误。 物品类型是字符串。

    提醒你一下:

    potion = pet.findNearestByType("potion")
    pet.fetch(potion)

    钥匙陷阱 解法

    # 获得三把钥匙并释放圣骑士。
    def onSpawn(event):
        # 宠物需要找到并拿回3个钥匙。
        # 您需要下一个类型的物品:
        # "bronze-key", "silver-key"和 "gold-key"
        pet.fetch(pet.findNearestByType("bronze-key"))
        pet.fetch(pet.findNearestByType("silver-key"))
        pet.fetch(pet.findNearestByType("gold-key"))
    pet.on("spawn", onSpawn)
    while True:
        enemy = hero.findNearestEnemy()
        if enemy and enemy.team == "ogres":
            hero.attack(enemy)
        if hero.health < 300:
            # 你也可以在主线程中使用宠物
            potion = pet.findNearestByType("potion")
            if potion:
                hero.moveXY(potion.pos.x, potion.pos.y)
     
    本攻略发于极客战记官方教学栏目,原文地址为:
     
  • 相关阅读:
    记一次笔试题
    模块模式浅析
    在windows上面实现ubuntu的三种方法
    移动端事件(五)—— 函数防抖和函数节流的封装
    一文分清强弱、动态静态类型语言
    为什么前端要学TypeScript
    OpenSSL SSL_read: Connection was reset, errno 10054
    浅悉http1.0 、http1.1和http2.0的区别
    上班一个月的总结
    从浅入深——理解JSONP的实现原理
  • 原文地址:https://www.cnblogs.com/codecombat/p/13222989.html
Copyright © 2011-2022 走看看