sonic-radiance/sonic-radiance.love/scenes/overworld/actors/player/charset.lua
2021-04-10 17:41:53 +02:00

32 lines
812 B
Lua

local PlayerCharset = Object:extend()
local ACTIONS_LARGEANIM = {"jump"}
local ACTIONS_ISFAST = {"jump"}
function PlayerCharset:initPlayerCharset()
self:updateCurrentCharset()
end
function PlayerCharset:updateCurrentCharset()
self:setCharset(self:getCharset(), self.active.data.charId)
self.isFast = self:getIsFast()
self.largeAnim = self:getLargeAnim()
end
function PlayerCharset:getCharset()
local charset = self.active.data.charset
if (self.currentAction == "jump") then
charset = charset .. "-jump"
end
return charset
end
function PlayerCharset:getLargeAnim()
return utils.table.contain(ACTIONS_ISFAST, self.currentAction)
end
function PlayerCharset:getIsFast()
return utils.table.contain(ACTIONS_LARGEANIM, self.currentAction)
end
return PlayerCharset