diff options
author | Aki <nthirtyone@gmail.com> | 2017-02-09 18:05:05 +0100 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-02-09 18:05:05 +0100 |
commit | 32d5db517b330963c737d29c693ad592ec62e697 (patch) | |
tree | bd19cb47f13eb698d36fe457cb54e352bf55086c /player.lua | |
parent | a7b1bcc6872579b0ed8dbce399352d3afca1a80f (diff) | |
parent | c4cec4731cdf10ac2740775c08efbda571e58040 (diff) | |
download | roflnauts-32d5db517b330963c737d29c693ad592ec62e697.zip roflnauts-32d5db517b330963c737d29c693ad592ec62e697.tar.gz roflnauts-32d5db517b330963c737d29c693ad592ec62e697.tar.bz2 |
Merge branch 'fix/draw'
Diffstat (limited to 'player.lua')
-rw-r--r-- | player.lua | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -292,9 +292,11 @@ function Player:draw(offset_x, offset_y, scale, debug) local scale = scale or 1 local debug = debug or false local x, y = self:getPosition() - -- pixel grid + -- pixel grid ; `approx` selected to prevent floating characters on certain conditions + local approx = math.floor + if (y - math.floor(y)) > 0.5 then approx = math.ceil end + local draw_y = (approx(y) + offset_y) * scale local draw_x = (math.floor(x) + offset_x) * scale - local draw_y = (math.floor(y) + offset_y) * scale -- sprite draw Animated.draw(self, draw_x, draw_y, self.rotate, self.facing*scale, scale, 12, 15) -- debug draw |