concodecombat 森林代码代码战役第十一关怎么过

> 博客详情
codecombat中国游戏网址:
所有代码为javascript代码分享
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1、Boom!&and&Bust
//&Use&your&buildXY&hammer&to&build&two&"fire-trap"s&near&the&gate.
//&They&will&detonate&when&you&move&back&to&a&safe&distance!
//&Then,&make&a&run&for&the&forest!
this.buildXY("fire-trap",&35,&35);
this.buildXY("fire-trap",&35,&30);
this.moveLeft(1);
this.moveRight(3);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2、森林保卫战
//&建立两个围栏保护村民
//&把鼠标放在地图上得到X,Y坐标
this.buildXY("fence",&40,&52);
this.buildXY("fence",&40,&20);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3、羊肠小道
//&到小路的尽头去,并在那儿修一个栅栏。
//&利用你的&moveXY(x,&y)坐标移动功能。
this.moveXY(34,&45);
this.moveXY(36,&59);
this.moveXY(36,&42);
this.moveXY(48,&22);
this.moveXY(36,&13);
this.moveXY(71,&17);
this.moveXY(73,&63);
this.moveXY(71,&17);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4、咬手指的人
//&只有当&if&条件为真的时候,if&语句下面的命令才会执行。
//&在条件中,==表示左右两边相等
if&(2&+&2&==&4)&{
&&&&this.say("Hey!");
if&(2&+&2&==&5)&{
&&&&this.say("Yes,&you!");
//&改变这里的条件让你的英雄说『来找我!』
if&(1)&{&&//&?&Make&this&true.
&&&&this.say("Come&at&me!");
if&(1)&{&&//&?&Make&this&true.
&&&&//&添加一句或者更多骂人的话来吸引食人魔,来点有创意的!
&&&&this.say("fuck&you&bitch&!");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5、宝石或者死亡
//&在&if&条件下的命令只有在条件为真的时候运行。
//&修复所有的&if&条件判定来赢得本关
//&==的意思是等于
if&(1&+&1&+&1&==&4)&{&&//&?&Make&this&false.
&&&&this.moveXY(5,&15);&&//&移动到第一个地雷位置
if&(2&+&2&==&4)&{&&//&?&Make&this&true.
this.moveXY(15,&41);&&//&移动到第一个宝石的位置。
//&!=的意思是不等于
if&(2&+&2&!=&3)&{&&//&?&Make&this&true.
this.moveXY(25,&16);&&//&移动到第二个宝石的位置
//&&的意思是比什么小
if&(2&+&2&&&5)&{&&//&?&Make&this&true.
&&&&var&enemy&=&this.findNearestEnemy();
&&&&this.attack(enemy);
if&(2&&&1)&{&&//&?&Make&this&false.
this.moveXY(40,&55);
if&(false)&{&&//&?&Make&this&false.
this.moveXY(50,&10);
if&(true)&{&&//&?&Make&this&true.
this.moveXY(55,&26);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6、边远伏击
//&移动到各个节点,并消灭每一个食人魔。
this.moveXY(24,&42);
var&enemy1&=&this.findNearestEnemy();
//&在攻击之前,使用if语句来确保当前有敌人存在。
if&(enemy1)&{
this.attack(enemy1);
this.attack(enemy1);
this.moveXY(27,&60);
var&enemy2&=&this.findNearestEnemy();
if&(enemy2)&{
this.attack(enemy2);
this.attack(enemy2);
this.moveXY(42,&50);
//&再使用一个if语句并攻击!
var&enemy3&=&this.findNearestEnemy();
if(enemy3){
&&&&this.attack(enemy3);
&&&&this.attack(enemy3);
//&移动到下一个节点并消灭剩余的食人魔。
this.moveXY(39,&24);
var&enemy4&=&this.findNearestEnemy();
if(enemy4){
&&&&this.attack(enemy4);
&&&&this.attack(enemy4);
this.moveXY(55,&29);
var&enemy5&=&this.findNearestEnemy();
if(enemy5){
&&&&this.attack(enemy5);
&&&&this.attack(enemy5);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7、巡逻兵克星
//记得提升自己的装备水平
//&记得敌人可能还不存在。
&&&&enemy&=&this.findNearestEnemy();
&&&&//&如果是敌人,攻击它!
&&&&if(enemy){
&&&&&&&&this.attack(enemy);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8、濒危树林之战
//&只攻击幼小食人魔和投掷者食人魔。
//&别攻击树榴,遇到食人魔快跑。
&&&&var&enemy&=&this.findNearestEnemy();
&&&&//&记住:别攻击树榴『burl』
&&&&if&(enemy.type&==&"burl")&{
&&&&&&&&this.say("我不攻击树榴『burl』");
&&&&//&type&属性告诉你它是什么种类的生物
&&&&if&(enemy.type&==&"munchkin")&{
&&&&&&&&this.attack(enemy);
&&&&//&使用『if』来攻击投掷者『thrower』
&&&&if&(enemy.type&==&"thrower")&{
&&&&&&&&this.attack(enemy);
&&&&//&如果它是一个食人魔『ogre』,跑到村口去!
&&&&if&(enemy.type&==&"ogre")&{
&&&&&&&&this.moveXY(20,&40);&&&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9、村庄守护者
//&在村口巡逻。
//&如果发现敌人,击杀他们。
&&&&this.moveXY(35,&34);
&&&&var&leftEnemy&=&this.findNearestEnemy();
&&&&if&(leftEnemy)&{
&&&&&&&&this.attack(leftEnemy);
&&&&&&&&this.attack(leftEnemy);
&&&&//&现在移动到右侧。
&&&&this.moveXY(60,&34);
&&&&//&使用if指令判断是否有敌人,有的话,击杀他们。
&&&&var&rightEnemy&=&this.findNearestEnemy();
&&&&if&(rightEnemy)&{
&&&&&&&&this.attack(rightEnemy);
&&&&&&&&this.attack(rightEnemy);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10、荆棘农场
//&在村口巡逻。
//&当你见到食人魔,建立一个火焰陷阱。
//&不要让任何农民受到伤害。
&&&&this.moveXY(43,&50);
&&&&var&topEnemy&=&this.findNearestEnemy();
&&&&if&(topEnemy)&{
&&&&&&&&this.buildXY("fire-trap",&43,&50);
&&&&this.moveXY(25,&34);
&&&&var&leftEnemy&=&this.findNearestEnemy();
&&&&if&(leftEnemy)&{
&&&&&&&&this.buildXY("fire-trap",&25,&34);
&&&&this.moveXY(43,&20);
&&&&var&buttomEnemy&=&this.findNearestEnemy();
&&&&if&(buttomEnemy)&{
&&&&&&&&this.buildXY("fire-trap",&43,&20);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11、背靠背
//&呆在中间防守
&&&&var&enemy&=&this.findNearestEnemy();
&&&&if&(enemy)&{
&&&&&&&&//&主动出击
&&&&&&&&this.attack(enemy);
&&&&else&{
&&&&&&&&//&回到你的阵地防守
&&&&&&&&this.moveXY(40,&34);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
番外:地牢第38关~~毁灭天使
this.moveDown();
//&妈妈总对我说,随便吃点你在地牢里找到的蘑菇。
this.moveRight();
this.moveDown();
this.moveUp();
this.moveLeft();
this.moveDown(2);
this.moveRight(4);
this.moveUp();
this.moveLeft();
this.moveUp();
this.moveRight();
this.moveUp();
this.moveLeft();
this.moveDown();
//&找到你去地牢守卫者的路。
&&&&var&enemy&=&this.findNearestEnemy();
&&&&if&(enemy)&{
&&&&&&&&this.attack(enemy);
人打赏支持
码字总数 43971
支付宝支付
微信扫码支付
打赏金额: ¥
已支付成功
打赏金额: ¥

我要回帖

更多关于 codecombat 森林代码 的文章

 

随机推荐