modules/assets: add a way to determine ox and oy in tileset metadata
This commit is contained in:
parent
0fba67f212
commit
257eec8290
2 changed files with 8 additions and 0 deletions
|
@ -2,6 +2,8 @@ return {
|
|||
metadata = {
|
||||
height = 24,
|
||||
width = 32,
|
||||
ox = 16,
|
||||
oy = 12,
|
||||
defaultAnim = "idle"
|
||||
},
|
||||
animations = {
|
||||
|
|
|
@ -91,15 +91,21 @@ end
|
|||
|
||||
function Tileset:drawTile_Grid(i, j, x, y, r, sx, sy, ox, oy, kx, ky)
|
||||
local tileID = self:getTileID_Grid(i, j)
|
||||
local ox = ox or self.metadata.ox
|
||||
local oy = oy or self.metadata.oy
|
||||
self.texture:drawQuad(self.quads[tileID], x, y, r, sx, sy, ox, oy, kx, ky)
|
||||
end
|
||||
|
||||
function Tileset:drawTile(id, x, y, r, sx, sy, ox, oy, kx, ky)
|
||||
local ox = ox or self.metadata.ox
|
||||
local oy = oy or self.metadata.oy
|
||||
self.texture:drawQuad(self.quads[id], x, y, r, sx, sy, ox, oy, kx, ky)
|
||||
end
|
||||
|
||||
function Tileset:drawTileMask_Grid(i, j, x, y, r, sx, sy, ox, oy, kx, ky)
|
||||
local tileID = self:getTileID_Grid(i, j)
|
||||
local ox = ox or self.metadata.ox
|
||||
local oy = oy or self.metadata.oy
|
||||
self.texture:drawMaskQuad(self.quads[tileID], x, y, r, sx, sy, ox, oy, kx, ky)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue