movement restrictions

This commit is contained in:
2021-12-27 11:46:57 +01:00
parent 526f0c369c
commit 5f6e23b921
5 changed files with 71 additions and 23 deletions

View File

@@ -292,3 +292,19 @@ end
function Segment:insert(list)
end
function Segment:pointInSegment(point)
if self.direction == 'up' or self.direction == 'down' then
if point[1] <= self.firstPointX + 1 and
point[1] >= self.firstPointX - 1 then
return true
end
else
if point[2] <= self.firstPointY + 1 and
point[2] >= self.firstPointY - 1 then
return true
end
end
return false
end