From 5bcf25a461bb9e04fdc5e3d5e0d5c370c26c5644 Mon Sep 17 00:00:00 2001 From: lustlion Date: Sun, 13 Mar 2022 10:36:19 +0100 Subject: [PATCH] fix typos and functions --- code/rect.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/code/rect.lua b/code/rect.lua index 55e84a8..32787e7 100644 --- a/code/rect.lua +++ b/code/rect.lua @@ -15,7 +15,7 @@ end -- clone refers to a deep copy function Rect:clone() - return Rect:fromCoods(self.min.x, self.min.y, self.max.x, self.max.y) + return Rect:fromCoords(self.min.x, self.min.y, self.max.x, self.max.y) end -- make sure min and max refer to the correct corners @@ -55,15 +55,17 @@ function Rect:corners() end function Rect:containsPoint(pt) - return self.min.x < pt.x and - self.min.y < pt.y and - pt.x < self.max.x and - pt.y < self.max.y + return pt.x >= self.min.x + and pt.y >= self.min.y + and pt.x <= self.max.x + and pt.y <= self.max.y end function Rect:overlapsRect(other) - return self.min.x other.min.x + and self.min.y < other.max.y + and self.max.y > other.min.y end function Rect:draw(style)