diff --git a/examples/test_scene2/init.lua b/examples/test_scene2/init.lua index e4ca4a1..588d5ac 100644 --- a/examples/test_scene2/init.lua +++ b/examples/test_scene2/init.lua @@ -59,11 +59,13 @@ function TestScene:draw() if self.estImpair then self.assets.images["debris"]:draw(16, 32) - self.assets.tileset["weapon"]:drawTile(1, 32, 32) + self.assets.tileset["weapon"]:drawTile(3, 32, 32) self.assets.sprites["poof"]:drawAnimation(64, 32) else love.graphics.setColor(0, 1, 0, 1) self.assets.images["debris"]:drawMask(16, 32) + self.assets.tileset["weapon"]:drawTileMask(3, 32, 32) + utils.graphics.resetColor() end end diff --git a/gamecore/modules/assets/tileset.lua b/gamecore/modules/assets/tileset.lua index 6cf23f9..40ae249 100644 --- a/gamecore/modules/assets/tileset.lua +++ b/gamecore/modules/assets/tileset.lua @@ -89,4 +89,14 @@ function Tileset:drawTile(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 +function Tileset:drawTileMask_Grid(i, j, x, y, r, sx, sy, ox, oy, kx, ky) + local tileID = self:getTileID_Grid(i, j) + self.texture:drawMaskQuad(self.quads[tileID], x, y, r, sx, sy, ox, oy, kx, ky) +end + +function Tileset:drawTileMask(id, x, y, r, sx, sy, ox, oy, kx, ky) + self.texture:drawMaskQuad(self.quads[id], x, y, r, sx, sy, ox, oy, kx, ky) +end + + return Tileset