diff options
author | Aki <nthirtyone@gmail.com> | 2016-08-13 18:19:34 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-08-13 18:19:34 +0200 |
commit | f7811309bcdb66467aed6a5c8c3870d646b5783a (patch) | |
tree | 82895699ffbd3e555f8f3c33b7c451280a4224d2 /player.lua | |
parent | 6018c668087bf49629fd95b3d5ca01213e4cc340 (diff) | |
download | roflnauts-f7811309bcdb66467aed6a5c8c3870d646b5783a.zip roflnauts-f7811309bcdb66467aed6a5c8c3870d646b5783a.tar.gz roflnauts-f7811309bcdb66467aed6a5c8c3870d646b5783a.tar.bz2 |
floored grid for players and platforms
Diffstat (limited to 'player.lua')
-rw-r--r-- | player.lua | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -293,14 +293,18 @@ end -- Draw of `Player` function Player:draw (offset_x, offset_y, scale, debug) - -- defaults + -- locals local offset_x = offset_x or 0 local offset_y = offset_y or 0 local scale = scale or 1 local debug = debug or false + 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 -- sprite draw love.graphics.setColor(255,255,255,255) - love.graphics.draw(self.sprite, self.current[self.frame], (self.body:getX()+offset_x)*scale, (self.body:getY()+offset_y)*scale, self.rotate, self.facing*scale, 1*scale, 12, 15) + love.graphics.draw(self.sprite, self.current[self.frame], draw_x, draw_y, self.rotate, self.facing*scale, 1*scale, 12, 15) -- debug draw if debug then love.graphics.setColor(137, 255, 0, 140) |