diff options
| author | Eltrac <hi@guhub.cn> | 2025-02-21 17:34:11 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-02-21 17:34:11 +0800 |
| commit | b436a3ec126de880b37bbfb6f9ce8f57c3419959 (patch) | |
| tree | b262d0538e04a3c92c6d4519949148946773541b /objects/Body.lua | |
| parent | 960f14ad41bda85cf33dd6b63f49124606d23b93 (diff) | |
fix: incorrect collison detection /w player and obstacles
Diffstat (limited to 'objects/Body.lua')
| -rw-r--r-- | objects/Body.lua | 9 |
1 files changed, 3 insertions, 6 deletions
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 |
