zoukankan      html  css  js  c++  java
  • 「网易官方」极客战记(codecombat)攻略-沙漠-空中桥梁-air-bridge

    (点击图片进入关卡)

    SOS!SOS! 我们需要一架直升机!

    简介

    农民被困。 我们需要帮助他们并清除雷区。 Grffin Baby宠物可以帮助我们完成这项任务。 它可以像抓物品一样抓起某个人, maxHealth < 0.1 * hero.maxHealth

    pet.carryUnit(unit,x,y)

    带农民,然后用munchkin清除雷区。

    默认代码

    # 帮助农民逃跑。

     

    def onSpawn(event):
        # 我们需要拯救三个农民。
        remainingPeasants = 3
        while remainingPeasants > 0:
            # 找到一个好位置。
            pet.moveXY(40, 55)
            peasant = pet.findNearestByType("peasant")
            if peasant:
                # 把农民带到中间的通道。
                pet.carryUnit(peasant, 40, 34)
                remainingPeasants -= 1
        munchkin = pet.findNearestByType("munchkin")
        # Carry a munchkin to the fire traps:

     

    pet.on("spawn", onSpawn)

     

    # 战斗!

     

    概览

    Grinffin宠物的独特能力是“抓起”,只需要告诉它抓起谁,放到哪里。

    thrower = pet.findNearestByType("thrower")
    pet.carryUnit(thrower, hero.pos.x + 3, hero.pos.y)

    空中桥梁解法

    # 帮助农民逃跑。

     

    def onSpawn(event):
        # 我们需要拯救三个农民。
        remainingPeasants = 3
        while remainingPeasants > 0:
            # 找到一个好位置。
            pet.moveXY(40, 55)
            peasant = pet.findNearestByType("peasant")
            if peasant:
                # 把农民带到中间的通道。
                pet.carryUnit(peasant, 40, 34)
                remainingPeasants -= 1
        munchkin = pet.findNearestByType("munchkin")
        # Carry a munchkin to the fire traps:
        if munchkin:
            pet.carryUnit(munchkin,40, 4)

     

    pet.on("spawn", onSpawn)

     

    # 战斗!
    while True:
        enemy = hero.findNearestEnemy()
        if enemy:
            hero.attack(enemy)
     
    本攻略发于极客战记官方教学栏目,原文地址为:
  • 相关阅读:
    大道至简观后感
    冲刺第二天
    梦断代码阅读笔记 02
    冲刺第一天
    第十周学习进度
    个人冲刺第一阶段个人任务--界面
    软工第二周个人作业
    软件工程开课博客(自我介绍)
    梦断代码阅读笔记01
    第二周学习进度报告
  • 原文地址:https://www.cnblogs.com/codecombat/p/13488890.html
Copyright © 2011-2022 走看看