diff options
author | Aki <nthirtyone@gmail.com> | 2016-08-13 21:13:31 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-08-13 21:13:31 +0200 |
commit | 99d537f66d34c5e87e4e395942a4241eeebd2b12 (patch) | |
tree | fe9ca1482710d32d69ff0c12cb405618179cfa3f | |
parent | 9f4ba7732c280ff1ef3bb810942d46378dc21e63 (diff) | |
download | roflnauts-99d537f66d34c5e87e4e395942a4241eeebd2b12.zip roflnauts-99d537f66d34c5e87e4e395942a4241eeebd2b12.tar.gz roflnauts-99d537f66d34c5e87e4e395942a4241eeebd2b12.tar.bz2 |
Effects draw grid
-rw-r--r-- | effect.lua | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -32,6 +32,11 @@ function Effect:new(name, x, y) return o end +-- Position +function Cloud:getPosition() + return self.x, self.y +end + -- Animation and return flag for deletion after completion -- returns true if completed and ready to delete function Effect:update(dt) @@ -49,11 +54,15 @@ end -- Draw me with scale and offsets, senpai function Effect: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) - love.graphics.draw(self.sprite, self.quads[self.animation][self.frame], (self.x+offset_x)*scale, (self.y+offset_y)*scale, 0, scale, scale) + love.graphics.draw(self.sprite, self.quads[self.animation][self.frame], draw_x, draw_y, 0, scale, scale) end
\ No newline at end of file |