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)
|
function Animator:changeAnimation(name, restart)
|
||||||
self.currentAnimation = name
|
self.currentAnimation = name
|
||||||
self.animationData = self.sprite.data.animations[self.currentAnimation]
|
self.animationData = self.sprite.data.animations[self.currentAnimation]
|
||||||
local restart = restart or true
|
local restart = restart or true
|
||||||
|
|
||||||
if (restart) then
|
if (restart) then
|
||||||
self.frame = self.animationData.startAt
|
self.frame = self.animationData.startAt
|
||||||
self.frameTimer = 0
|
self.frameTimer = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ local Autotile = Object:extend()
|
||||||
function Autotile:new(filepath)
|
function Autotile:new(filepath)
|
||||||
self.tileset = Tileset(filepath)
|
self.tileset = Tileset(filepath)
|
||||||
|
|
||||||
self.data = require(filepath .. ".lua")
|
self.data = require(filepath .. ".lua")
|
||||||
self.metadata = self.data.metadata
|
self.metadata = self.data.metadata
|
||||||
|
|
||||||
self.tilesize = self.metadata.width
|
self.tilesize = self.metadata.width
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
local Background = Object:extend()
|
local Background = Object:extend()
|
||||||
|
|
||||||
function Background:new(filepath)
|
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.batch = love.graphics.newSpriteBatch(self.image , 1000 )
|
||||||
|
|
||||||
self.width, self.height = self.image:getDimensions()
|
self.width, self.height = self.image:getDimensions()
|
||||||
|
|
|
@ -4,11 +4,11 @@ local Font = Object:extend()
|
||||||
|
|
||||||
function Font:new(filename, size)
|
function Font:new(filename, size)
|
||||||
local filename = filename
|
local filename = filename
|
||||||
self.font = love.graphics.newFont(filename, size)
|
self.font = love.graphics.newFont(filename, size)
|
||||||
self.filter = ""
|
self.filter = ""
|
||||||
self:setColor(1, 1, 1, 1)
|
self:setColor(1, 1, 1, 1)
|
||||||
self:setSpacing(false, 0)
|
self:setSpacing(false, 0)
|
||||||
self.align = "left"
|
self.align = "left"
|
||||||
end
|
end
|
||||||
|
|
||||||
function Font:set()
|
function Font:set()
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
local Assets = Object:extend()
|
local Assets = Object:extend()
|
||||||
|
|
||||||
local Sprite = require "core.modules.assets.sprites"
|
local Sprite = require "core.modules.assets.sprites"
|
||||||
local Font = require "core.modules.assets.fonts"
|
local Font = require "core.modules.assets.fonts"
|
||||||
local Tileset = require "core.modules.assets.tileset"
|
local Tileset = require "core.modules.assets.tileset"
|
||||||
local Autotile = require "core.modules.assets.autotile"
|
local Autotile = require "core.modules.assets.autotile"
|
||||||
local Background = require "core.modules.assets.background"
|
local Background = require "core.modules.assets.background"
|
||||||
|
|
||||||
|
|
||||||
function Assets:new()
|
function Assets:new()
|
||||||
|
|
|
@ -7,7 +7,7 @@ local Tileset = require("core.modules.assets.tileset")
|
||||||
|
|
||||||
function Sprite:new(filepath)
|
function Sprite:new(filepath)
|
||||||
self.tileset = Tileset(filepath)
|
self.tileset = Tileset(filepath)
|
||||||
self.data = require(filepath)
|
self.data = require(filepath)
|
||||||
|
|
||||||
self.animator = Animator(self)
|
self.animator = Animator(self)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue