- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
if closedk>0 then
for k=1,closedk do
if closedlist[k].x==curbase.x+1 and closedlist[k].y==curbase.y then
rightOK=false
end
if closedlist[k].x==curbase.x-1 and closedlist[k].y==curbase.y then
leftOK=false
end
if closedlist[k].x==curbase.x and closedlist[k].y==curbase.y+1 then
downOK=false
end
if closedlist[k].x==curbase.x and closedlist[k].y==curbase.y-1 then
upOK=false
end
end
end
-- Check if next points are on the map and within moving distance
if curbase.x+1>xsize then
rightOK=false
end
if curbase.x-1<1 then
leftOK=false
end
if curbase.y+1>ysize then
downOK=false
end
if curbase.y-1<1 then
upOK=false
end
-- If it IS on the map, check map for obstacles
--(Lua returns an error if you try to access a table position that doesn't exist, so you can't combine it with above)
if curbase.x+1<=xsize and mapmat[curbase.y][curbase.x+1]~=0 then
rightOK=false
end
if curbase.x-1>=1 and mapmat[curbase.y][curbase.x-1]~=0 then
leftOK=false
end
if curbase.y+1<=ysize and mapmat[curbase.y+1][curbase.x]~=0 then
downOK=false
end
if curbase.y-1>=1 and mapmat[curbase.y-1][curbase.x]~=0 then
upOK=false
end
barop 31.10.2016 05:06 # −65
_____ 31.10.2016 08:34 # 0
У того моча в голове устроила потоп