src/core: improve style in the assets module
This commit is contained in:
parent
21659cedb7
commit
6a28069680
6 changed files with 12 additions and 12 deletions
|
@ -47,11 +47,11 @@ end
|
|||
|
||||
function Animator:changeAnimation(name, restart)
|
||||
self.currentAnimation = name
|
||||
self.animationData = self.sprite.data.animations[self.currentAnimation]
|
||||
self.animationData = self.sprite.data.animations[self.currentAnimation]
|
||||
local restart = restart or true
|
||||
|
||||
if (restart) then
|
||||
self.frame = self.animationData.startAt
|
||||
self.frame = self.animationData.startAt
|
||||
self.frameTimer = 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ local Autotile = Object:extend()
|
|||
function Autotile:new(filepath)
|
||||
self.tileset = Tileset(filepath)
|
||||
|
||||
self.data = require(filepath .. ".lua")
|
||||
self.data = require(filepath .. ".lua")
|
||||
self.metadata = self.data.metadata
|
||||
|
||||
self.tilesize = self.metadata.width
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
local Background = Object:extend()
|
||||
|
||||
function Background:new(filepath)
|
||||
self.image = love.graphics.newImage(filepath)
|
||||
self.image = love.graphics.newImage(filepath)
|
||||
self.batch = love.graphics.newSpriteBatch(self.image , 1000 )
|
||||
|
||||
self.width, self.height = self.image:getDimensions()
|
||||
|
|
|
@ -4,11 +4,11 @@ local Font = Object:extend()
|
|||
|
||||
function Font:new(filename, size)
|
||||
local filename = filename
|
||||
self.font = love.graphics.newFont(filename, size)
|
||||
self.font = love.graphics.newFont(filename, size)
|
||||
self.filter = ""
|
||||
self:setColor(1, 1, 1, 1)
|
||||
self:setSpacing(false, 0)
|
||||
self.align = "left"
|
||||
self.align = "left"
|
||||
end
|
||||
|
||||
function Font:set()
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
local Assets = Object:extend()
|
||||
|
||||
local Sprite = require "core.modules.assets.sprites"
|
||||
local Font = require "core.modules.assets.fonts"
|
||||
local Tileset = require "core.modules.assets.tileset"
|
||||
local Autotile = require "core.modules.assets.autotile"
|
||||
local Background = require "core.modules.assets.background"
|
||||
local Sprite = require "core.modules.assets.sprites"
|
||||
local Font = require "core.modules.assets.fonts"
|
||||
local Tileset = require "core.modules.assets.tileset"
|
||||
local Autotile = require "core.modules.assets.autotile"
|
||||
local Background = require "core.modules.assets.background"
|
||||
|
||||
|
||||
function Assets:new()
|
||||
|
|
|
@ -7,7 +7,7 @@ local Tileset = require("core.modules.assets.tileset")
|
|||
|
||||
function Sprite:new(filepath)
|
||||
self.tileset = Tileset(filepath)
|
||||
self.data = require(filepath)
|
||||
self.data = require(filepath)
|
||||
|
||||
self.animator = Animator(self)
|
||||
|
||||
|
|
Loading…
Reference in a new issue