极客战记-跃火林中
如果你卡在这里了,那么看看这个攻略吧
准备工作
1、选择英雄和编程语言
2、选择装备
3、写中文注释
python
1、写代码#在这关,别碰恶魔石!往其他方向移动避开它们!whileTrue:evilstone=hero.findNearestItem()ifevilstone:pos=evilstone.posifpos.x==34:#如果恶魔石在左边,走到右边。hero.moveXY(46,22)passelse:#如果恶魔石在右边,走到左边。hero.moveXY(34,22)passelse:#如果没有恶魔石,那就去到中间。hero.moveXY(40,22)pass
2、运行
javascript
1、写代码// 在这关,别碰恶魔石!往其他方向移动避开它们!while(true) { var evilstone = h髫潋啜缅ero.findNearestItem(); if (evilstone) { var pos = evilstone.pos; if (pos.x == 34) { // 如果恶魔石在左边,走到右边。 hero.moveXY(46, 22); } else{ // 如果恶魔石在右边,走到左边。 hero.moveXY(34, 22); }} else{ // 如果没有恶魔石,那就去到中间。 hero.moveXY(40, 22); }}
2、运行
coffeescript
1、写代码# 在这关,别鳏叼爝炽碰恶魔石!往其他方向移动避开它们!while true evilstone = hero.findNearestItem() if evilstone pos = evilstone.pos if pos.x == 34 # 如果恶魔石在左边,走到右边。 hero.moveXY(46, 22) else # 如果恶魔石在右边,走到左边。 hero.moveXY(34, 22) else # 如果没有恶魔石,那就去到中间。 hero.moveXY(40, 22)
2、运行
lua
1、写代码-- 在这关,别碰恶魔石!往其他方向移动避开它们!while true do local evilstone = hero:findNearestItem() if evilstone then local pos = evilstone.pos if pos.x == 34 then -- 如果恶魔石在左边,走到右边。 hero:moveXY(46, 22) else -- 如果恶魔石在右边,走到左边。 hero:moveXY(34, 22) end else -- 如果没有恶魔石,那就去到中间。 hero:moveXY(40, 22) endend
2、运行