平常的一天 感觉代码没问题 任务失败是没有在六行代码内写完
codecombat吧
全部回复
仅看楼主
level 2
That_arrive 楼主
2017年02月13日 07点02分 1
level 2
That_arrive 楼主
可是我只写了 5行 为什么过不去
2017年02月13日 07点02分 2
你玩的网址是多少呀?
2017年02月14日 05点02分
cn.codecombat.com
2017年02月14日 07点02分
level 1
2017年02月14日 02点02分 3
level 2
while (true) {
var enemy = hero.findNearestEnemy();
// 有了与(AND),只在敌人存在时检查类型
if (enemy && enemy.type == "munchkin") {
hero.attack(enemy);
}
// 寻找最近的物品
var item = hero.findNearestItem();
// 如果有名为 “coin” (金币)的物品存在,那就快去收集它!
if (item && item.type == "coin") {
hero.moveXY(item.pos.x, item.pos.y);
}
}
2017年02月14日 14点02分 4
呃……这种写法前面例子里有提到,另外,我以前学过一点h5跟js,[滑稽]推荐w3cschool,看看讲解,对定义跟规则会有更好的理解。codecombat只是更有趣些
2017年02月14日 14点02分
搞定了 感谢
2017年02月16日 02点02分
1