diff options
Diffstat (limited to 'decoration.lua')
-rw-r--r-- | decoration.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/decoration.lua b/decoration.lua index 226b7f9..346ff65 100644 --- a/decoration.lua +++ b/decoration.lua @@ -19,12 +19,16 @@ function Decoration:getPosition() return self.x, self.y end function Decoration:draw(offset_x, offset_y, scale) - -- defaults + -- locals local offset_x = offset_x or 0 local offset_y = offset_y or 0 local scale = scale or 1 + local x, y = self:getPosition() + -- pixel grid + local draw_x = (math.floor(x) + offset_x) * scale + local draw_y = (math.floor(y) + offset_y) * scale -- draw love.graphics.setColor(255,255,255,255) local x, y = self:getPosition() - love.graphics.draw(self.sprite, (x+offset_x)*scale, (y+offset_y)*scale, 0, scale, scale) + love.graphics.draw(self.sprite, draw_x, draw_y, 0, scale, scale) end
\ No newline at end of file |