兰顿蚂蚁路径lua测试

兰顿蚂蚁

local p=0

local x,y,z=0,7,0

local function add()

local result,id = Block:getBlockID(x,y,z)

if id==1 then

Block:destroyBlock(x,y,z,false)

p=p+90

else

Block:setBlockAll(x,y,z,1,0)

p=p-90

end

x,z=x-math.floor(0.5+math.sin(math.rad(p))),z-math.floor(0.5+math.cos(math.rad(p)))

end

ScriptSupportEvent:registerEvent([=[Game.Run]=], add)

--add()

for p=-360,360,90 do

print(p,math.floor(0.5+math.sin(math.rad(p))),math.floor(0.5+math.cos(math.rad(p))))

end