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 = {
|
metadata = {
|
||||||
height = 24,
|
height = 24,
|
||||||
width = 32,
|
width = 32,
|
||||||
|
ox = 16,
|
||||||
|
oy = 12,
|
||||||
defaultAnim = "idle"
|
defaultAnim = "idle"
|
||||||
},
|
},
|
||||||
animations = {
|
animations = {
|
||||||
|
|
|
@ -91,15 +91,21 @@ end
|
||||||
|
|
||||||
function Tileset:drawTile_Grid(i, j, x, y, r, sx, sy, ox, oy, kx, ky)
|
function Tileset:drawTile_Grid(i, j, x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
local tileID = self:getTileID_Grid(i, j)
|
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)
|
self.texture:drawQuad(self.quads[tileID], x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tileset:drawTile(id, x, y, r, sx, sy, ox, oy, kx, ky)
|
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)
|
self.texture:drawQuad(self.quads[id], x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tileset:drawTileMask_Grid(i, j, x, y, r, sx, sy, ox, oy, kx, ky)
|
function Tileset:drawTileMask_Grid(i, j, x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
local tileID = self:getTileID_Grid(i, j)
|
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)
|
self.texture:drawMaskQuad(self.quads[tileID], x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue