Changes in class constructors. close #18
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
local mathRound = math.round
|
||||
|
||||
local getInstance = Class.getInstance
|
||||
|
||||
---@class TileSheet
|
||||
---@field image string Name of texture
|
||||
---@field width number Number of tiles in the table horizontally
|
||||
@@ -70,11 +72,11 @@ function TileSheet:new(image, tileWidth, tileHeight)
|
||||
end
|
||||
|
||||
---@type TileSheet
|
||||
local instance = setmetatable({
|
||||
local instance = getInstance(self, {
|
||||
image = image,
|
||||
width = mathRound(width / tileWidth),
|
||||
height = mathRound(height / tileHeight),
|
||||
}, {__index = self})
|
||||
})
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user