summaryrefslogtreecommitdiffhomepage
path: root/decoration.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-08-13 21:41:07 +0200
committerAki <nthirtyone@gmail.com>2016-08-13 21:41:07 +0200
commitd364ebe82e21018e3ef8645915e7f9ceacf84dd9 (patch)
treeec53ad55964a368226f124e6db86035e28d8a5f8 /decoration.lua
parentfdc0878e45872c8fa8af9a90a1e9f4a4bc98eece (diff)
downloadroflnauts-d364ebe82e21018e3ef8645915e7f9ceacf84dd9.zip
roflnauts-d364ebe82e21018e3ef8645915e7f9ceacf84dd9.tar.gz
roflnauts-d364ebe82e21018e3ef8645915e7f9ceacf84dd9.tar.bz2
Forgot about decorations!
Diffstat (limited to 'decoration.lua')
-rw-r--r--decoration.lua8
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