modules/assets: add a way to determine ox and oy in tileset metadata

This commit is contained in:
Kazhnuz 2019-05-01 11:24:41 +02:00
parent 0fba67f212
commit 257eec8290
2 changed files with 8 additions and 0 deletions

View file

@ -2,6 +2,8 @@ return {
metadata = {
height = 24,
width = 32,
ox = 16,
oy = 12,
defaultAnim = "idle"
},
animations = {

View file

@ -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