2022-08-12 10:50:42 +02:00
|
|
|
local Parent = require "framework.modules.gui.elements.drawable"
|
2021-12-04 13:18:54 +01:00
|
|
|
local TileElement = Parent:extend()
|
|
|
|
|
|
|
|
function TileElement:new(name, assetName, id, x, y,r,sx,sy,ox,oy, opacity)
|
|
|
|
self:initWrapper()
|
|
|
|
local asset = self.assets.tileset[assetName]
|
|
|
|
assert(asset ~= nil, assetName .. " ( tileset ) doesn't exist")
|
|
|
|
self.tileId = id
|
|
|
|
|
|
|
|
TileElement.super.new(self, name, asset, x, y,r,sx,sy,ox,oy, opacity)
|
|
|
|
end
|
|
|
|
|
|
|
|
function TileElement:draw()
|
|
|
|
love.graphics.setColor(1, 1, 1, self.opacity)
|
|
|
|
self.drawable:drawTile(self.tileId, self.x,self.y,self.r,self.sx,self.sy,self.ox,self.oy)
|
|
|
|
utils.graphics.resetColor()
|
|
|
|
end
|
|
|
|
|
|
|
|
return TileElement
|