From 960f14ad41bda85cf33dd6b63f49124606d23b93 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Fri, 21 Feb 2025 15:57:29 +0800 Subject: fix: drawing doors at wrong location --- objects/Body.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'objects/Body.lua') diff --git a/objects/Body.lua b/objects/Body.lua index aa5bd75..e9a4b94 100644 --- a/objects/Body.lua +++ b/objects/Body.lua @@ -38,11 +38,14 @@ function Body:collide(other, x1, y1, x2, y2) return false end -function Body:draw(x, y) +function Body:draw(x, y, offsetFix) if self.shape == "circle" then - love.graphics.circle("fill", x, y, self.r) + local offset = offsetFix and - self.r / 2 or 0 + love.graphics.circle("fill", x + offset, y + offset, self.r) elseif self.shape == "rectangle" then - love.graphics.rectangle("fill", x - self.w / 2, y - self.h / 2, self.w, self.h) + local offsetX = offsetFix and - self.w / 2 or 0 + local offsetY = offsetFix and - self.h / 2 or 0 + love.graphics.rectangle("fill", x + offsetX, y + offsetY, self.w, self.h) end end -- cgit v1.2.3