Added assets manager singleton.
This commit is contained in:
@@ -16,7 +16,8 @@ local Drawable = make_class(Asset)
|
||||
-- Class methods
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
function Drawable:_init()
|
||||
function Drawable:_init(file_name)
|
||||
Asset._init(self, file_name)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -17,15 +17,15 @@ local Sprite = make_class(Drawable)
|
||||
-- Class methods
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
function Sprite:_init(sprite_name, x, y)
|
||||
self.sprite_name = string.format('assets/%s', sprite_name)
|
||||
function Sprite:_init(file_name, x, y)
|
||||
Drawable._init(self, file_name)
|
||||
self.x = (x ~= nil and x) or 0
|
||||
self.y = (y ~= nil and y) or 0
|
||||
end
|
||||
|
||||
|
||||
function Sprite:load()
|
||||
self.sprite = love.graphics.newImage(self.sprite_name)
|
||||
self.sprite = love.graphics.newImage(self.file_name)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user