极客战记-背靠背

2025-11-16 06:32:17

1、选择英雄和编程语言

极客战记-背靠背

2、选择装备

极客战记-背靠背

3、写中文注释

极客战记-背靠背

1、写代码

#循环

while True:

    #找敌人

    enemy = hero.findNearestEnemy()

    #如果有敌人

    if enemy:

        #攻击

        hero.attack(enemy)

    #否则

    else:

        #到中间

        hero.moveXY(40, 36)

极客战记-背靠背

2、运行

极客战记-背靠背

1、写代码

//循环

while(true) {

    //找敌人

    var enemy = hero.findNearestEnemy();

    //如果有敌人

    if (enemy){

        //攻击

        hero.attack(enemy);

    }

    //否则

    else{

        //到中间

        hero.moveXY(40, 36);

        }

}

极客战记-背靠背

2、运行

极客战记-背靠背

1、写代码

#循环

while true        

    #找敌人

    enemy = hero.findNearestEnemy()

    #如果有敌人

    if enemy    

        #攻击

        hero.attack(enemy)

    #否则

    else

        #到中间

        hero.moveXY(40, 36)

极客战记-背靠背

2、运行

极客战记-背靠背

1、写代码

--循环

while true do

    --找敌人

    local enemy = hero:findNearestEnemy()

    --如果有敌人

    if enemy then        

        --攻击

        hero:attack(enemy)

    --否则

    else

        --到中间

        hero:moveXY(40, 36)

    end

end

极客战记-背靠背

2、运行

极客战记-背靠背

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
相关推荐
  • 阅读量:146
  • 阅读量:120
  • 阅读量:70
  • 阅读量:174
  • 阅读量:157
  • 猜你喜欢