fix: dont walk when sliding

This commit is contained in:
Kazhnuz 2021-04-21 17:20:09 +02:00
parent 28ca276bf5
commit 15bc5ae874

View file

@ -1,8 +1,9 @@
local PlayerCharset = Object:extend() local PlayerCharset = Object:extend()
local ACTIONS_LARGEANIM = {"jump"} local ACTIONS_LARGEANIM = {"jump", "jumpdash"}
local ACTIONS_ISFAST = {"jump", "fly", "run", "jumpdash"} local ACTIONS_ISFAST = {"jump", "fly", "run", "jumpdash"}
local ACTIONS_ALWAYSWALK = {"fly"} local ACTIONS_ALWAYSWALK = {"fly"}
local ACTIONS_DONTWALK = {"slide"}
function PlayerCharset:initPlayerCharset() function PlayerCharset:initPlayerCharset()
self.scissorSprite = true self.scissorSprite = true
@ -14,6 +15,7 @@ function PlayerCharset:updateCurrentCharset()
self.isFast = self:getIsFast() self.isFast = self:getIsFast()
self.largeAnim = self:getLargeAnim() self.largeAnim = self:getLargeAnim()
self.alwaysWalk = self:getAlwaysWalk() self.alwaysWalk = self:getAlwaysWalk()
self.cantWalk = self:getDontWalk()
end end
function PlayerCharset:getCharset() function PlayerCharset:getCharset()
@ -40,4 +42,12 @@ function PlayerCharset:getAlwaysWalk()
return utils.table.contain(ACTIONS_ALWAYSWALK, self.currentAction) return utils.table.contain(ACTIONS_ALWAYSWALK, self.currentAction)
end end
function PlayerCharset:getDontWalk()
if (self.forceAction ~= nil) then
return utils.table.contain(ACTIONS_DONTWALK, self.forceAction)
else
return utils.table.contain(ACTIONS_DONTWALK, self.currentAction)
end
end
return PlayerCharset return PlayerCharset