demo completed
This commit is contained in:
parent
2eb4f33864
commit
d50e5c0c35
4 changed files with 193 additions and 31 deletions
|
|
@ -55,6 +55,7 @@ function Mechanism:new( position, size, ports, color )
|
|||
return mechanism
|
||||
end
|
||||
|
||||
---@return Mechanism
|
||||
function Mechanism:clone()
|
||||
local ports = {}
|
||||
for _, port in ipairs(self.ports) do
|
||||
|
|
@ -67,6 +68,25 @@ function Mechanism:clone()
|
|||
ports = ports,
|
||||
color = self.color
|
||||
}
|
||||
setmetatable( mechanism, { __index = self } )
|
||||
|
||||
return mechanism
|
||||
end
|
||||
|
||||
function Mechanism:intersectsPoint( point )
|
||||
return point.x >= self.position.x and
|
||||
point.x < self.position.x + self.size.x and
|
||||
point.y >= self.position.y and
|
||||
point.y < self.position.y + self.size.y
|
||||
end
|
||||
|
||||
function Mechanism:intersectsOther( mechanism )
|
||||
return mechanism.position.x + mechanism.size.x > self.position.x and
|
||||
mechanism.position.x <
|
||||
self.position.x + self.size.x and
|
||||
mechanism.position.y + mechanism.size.y > self.position.y and
|
||||
mechanism.position.y < self.position.y + self.size.y
|
||||
|
||||
end
|
||||
|
||||
function Mechanism:rotateClockwise()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue