Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

centered sprites in their boundries

  • Loading branch information...
commit 8c31a4b4203933e670223d0c561785d93c4b0708 1 parent efb1265
@Textmode Textmode authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  entity.lua
View
3  entity.lua
@@ -36,6 +36,7 @@ function _M.new(t)
e.dir_y = t.dir_y or 0
e.speed = t.speed or 0
e.facing = t.facing or 0
+ e.scale = t.scale or 1
-- Handles the texture, width, and height fields
_M.set_texture(e, t.texture or generic_icon)
@@ -94,7 +95,7 @@ function _M:draw()
-- draw the actual sprite
lg.setColor(255, 255, 255)
- lg.draw(self.texture, self.pos_x, self.pos_y, self.facing)
+ lg.draw(self.texture, self.pos_x, self.pos_y, self.facing, self.scale, self.scale, self.width/2, self.height/2)
lg.pop()
end
Please sign in to comment.
Something went wrong with that request. Please try again.