From d364ebe82e21018e3ef8645915e7f9ceacf84dd9 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 13 Aug 2016 21:41:07 +0200 Subject: Forgot about decorations! --- decoration.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'decoration.lua') 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 -- cgit v1.1