diff options
| author | Eltrac <hi@guhub.cn> | 2025-03-13 10:55:24 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-03-13 10:55:24 +0800 |
| commit | aa3d4e377fddf077e2b8cc77f17c1eefd5f97b5e (patch) | |
| tree | f13c7b5caedb666c696e3cf91a1b36295b85f0c6 /objects/Body.lua | |
| parent | 7a48e0303241ff30572028d3c8cc303c09b04fa3 (diff) | |
refactor: remove body:draw method
Diffstat (limited to 'objects/Body.lua')
| -rw-r--r-- | objects/Body.lua | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/objects/Body.lua b/objects/Body.lua index 4ca50d1..30ac165 100644 --- a/objects/Body.lua +++ b/objects/Body.lua @@ -15,34 +15,4 @@ function Body:new(shape, sizeA, sizeB, zoom) return obj end -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 - self.w / 2, y - self.h / 2, self.w, self.h) - end -end - -function Body:drawSprite(spriteName, x, y, angle) - local sprite = sprite.get(spriteName) - local w, h = (self.shape == "circle" and self.r or self.w), (self.shape == "circle" and self.r or self.h) - - love.graphics.draw(sprite, x, y, angle, - w / sprite:getWidth(), - h / sprite:getHeight() - ) -end - -function Body:drawQuad(sheet, index, x, y, angle) - if self.shape == "circle" then - local r = self.r - local graphicR = r * self.zoom - sprite.drawQuad(sheet, index, x - r, y - r, graphicR, graphicR, angle or 0) - else - local w, h = self.w, self.h - local graphicW, graphicH = w * self.zoom, h * self.zoom - sprite.drawQuad(sheet, index, x - w/2, y - h/2, graphicW, graphicH, angle or 0) - end -end - return Body |
