CodeCombat(极客战记)村庄守护者代码-python

CodeCombat(极客战记)村庄守护者代码-python

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


这里写图片描述

# 在村口巡逻。
# 如果发现敌人,就攻击它。
while True:
    hero.moveXY(35, 34)
    left = hero.findNearestEnemy()
    if left:
        hero.attack(left)
    # 现在移动到右侧入口。
    hero.moveXY(60, 31)
    # 找到正确的敌人。
    # 如果有正确的敌人,使用if来攻击。
    right = hero.findNearestEnemy()
    if right:
        hero.attack(right)

猜你喜欢

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