在线学习,从潘多拉盒子开始!-潘多拉盒子

开启左侧

[晒代码] [困难关卡][find the spy]

[复制链接]
xinlan 发表于 2014-6-15 19:18:11 | 显示全部楼层 |阅读模式
var soldiers = this.getCombatants();

//Just killing the first soldier doesn't seem like a winning strategy...
//Click the "Guide" button if you need a hint on telling who is on what team
//var spy = soldiers[0];
for(var i = 0; i < soldiers.length;i++){
    var spy = soldiers[i];
if(spy.team == "ogres"){
if(this.distanceTo(spy) > this.attackRange){
    this.setTarget(spy);
    this.setAction("move");
}else{
    this.setTarget(spy);
    this.setAction("attack");

}
}}
回复

使用道具 举报


快速回复 返回顶部 返回列表