loop
-- 你怎么寻找最近的友好单位?
-- 马=?
horse = this.self:findNearest(this.findFriends())
if horse then
x1 = horse.pos.x - 7
x2 = horse.pos.x + 7
y = horse.pos.y
if x1 >= 1 then
self:moveXY(x1, y)
-- 移动到马的y坐标,但使用x1作为x坐标。
elseif x2 <= 79 then
self:moveXY(x2, y)
-- 移动到马的y坐标,但使用x2作为x坐标。
local distance = self:distanceTo(horse)
if distance <= 10 then
self:say("Whoa")
-- 移到到红色的x来使马返回农场。
self:moveXY(27, 54)
-- 移回牧场开始寻找下一匹马。
self:moveXY(43, 21)
end
end
end
end
this is my code.but it always break some mistake.
Uppercase or lowercase problem.Try this.
I have used this, why it show me this again…
thank you for your help~