fix: add turning handling in parent file

This commit is contained in:
Kazhnuz 2021-03-22 21:14:40 +01:00
parent 2cf4559a81
commit 52243c7d8c

View file

@ -27,6 +27,7 @@ function Parent:initCharset()
self.charDir = "down" self.charDir = "down"
self.cantWalk = false self.cantWalk = false
self.cantTurn = false self.cantTurn = false
self.isTurning = false
end end
function Parent:setCharset(charset, charId, cantWalk) function Parent:setCharset(charset, charId, cantWalk)
@ -40,10 +41,15 @@ function Parent:drawCharset(charset, charId)
love.graphics.setColor(1,1,1,0.5) love.graphics.setColor(1,1,1,0.5)
self.assets.images["shadow"]:draw(x + 1, y + 10) self.assets.images["shadow"]:draw(x + 1, y + 10)
utils.graphics.resetColor() utils.graphics.resetColor()
if (self:isMoving() and (not self.cantWalk)) then
self.charsetManager:draw(self.charset, self.charId, self.charDir, x, y - 1) if (not self.isTurning) then
if (self:isMoving() and (not self.cantWalk)) then
self.charsetManager:draw(self.charset, self.charId, self.charDir, x, y - 1)
else
self.charsetManager:drawStanding(self.charset, self.charId, self.charDir, x, y - 1)
end
else else
self.charsetManager:drawStanding(self.charset, self.charId, self.charDir, x, y - 1) self.charsetManager:drawTurning(self.charset, self.charId, x, y - 1)
end end
end end