summaryrefslogtreecommitdiff
path: root/objects/Body.lua
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-03-11 12:09:10 +0800
committerEltrac <hi@guhub.cn>2025-03-11 12:09:10 +0800
commit1ce654dbe1727153d31659e257ffc64e6815a35b (patch)
treee65b2d82ce1d0ac06a90104b0c854a45f005308b /objects/Body.lua
parentf9be42a766792538ff941da98c5d76f9244e1c2d (diff)
refactor: implement physics engine
replace original moving logic and collision detection with love.physics
Diffstat (limited to 'objects/Body.lua')
-rw-r--r--objects/Body.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/objects/Body.lua b/objects/Body.lua
index c473c69..d5a4e58 100644
--- a/objects/Body.lua
+++ b/objects/Body.lua
@@ -43,7 +43,7 @@ function Body:draw(x, y)
if self.shape == "circle" then
love.graphics.circle("fill", x, y, self.r)
elseif self.shape == "rectangle" then
- love.graphics.rectangle("fill", x, y, self.w, self.h)
+ love.graphics.rectangle("fill", x - self.w / 2, y - self.h / 2, self.w, self.h)
end
end