From b436a3ec126de880b37bbfb6f9ce8f57c3419959 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Fri, 21 Feb 2025 17:34:11 +0800 Subject: fix: incorrect collison detection /w player and obstacles --- objects/Body.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'objects/Body.lua') diff --git a/objects/Body.lua b/objects/Body.lua index e9a4b94..dd6ac32 100644 --- a/objects/Body.lua +++ b/objects/Body.lua @@ -38,14 +38,11 @@ function Body:collide(other, x1, y1, x2, y2) return false end -function Body:draw(x, y, offsetFix) +function Body:draw(x, y) if self.shape == "circle" then - local offset = offsetFix and - self.r / 2 or 0 - love.graphics.circle("fill", x + offset, y + offset, self.r) + love.graphics.circle("fill", x, y, self.r) elseif self.shape == "rectangle" then - 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) + love.graphics.rectangle("fill", x, y, self.w, self.h) end end -- cgit v1.2.3