feat: add turning animation

This commit is contained in:
Kazhnuz 2021-03-22 21:04:55 +01:00
parent 11fc63b402
commit 2cf4559a81
2 changed files with 6 additions and 0 deletions

View file

@ -40,6 +40,7 @@ function Gizmo:applyProperties()
self.charset = self.properties.charset or nil self.charset = self.properties.charset or nil
self.charDir = self.properties.charDir or "down" self.charDir = self.properties.charDir or "down"
self.cantTurn = self.properties.cantTurn or self.cantTurn self.cantTurn = self.properties.cantTurn or self.cantTurn
self.isTurning = (self.properties.isTurning == true)
if (self.properties.event ~= nil) then if (self.properties.event ~= nil) then
local data = require("datas.gamedata.events." .. self.properties.event) local data = require("datas.gamedata.events." .. self.properties.event)
self.event = data.actions self.event = data.actions

View file

@ -78,4 +78,9 @@ function Charset:drawStanding(charsetName, charID, direction, x, y)
love.graphics.draw(drawable, quad, math.floor(x), math.floor(y), 0, 1, 1, 11, 32) love.graphics.draw(drawable, quad, math.floor(x), math.floor(y), 0, 1, 1, 11, 32)
end end
function Charset:drawTurning(charsetName, charID, x, y)
local dir = math.min(math.floor(self.currentFrame) + 1, 4)
return self:drawStanding(charsetName, charID, directionList[dir], x, y)
end
return Charset return Charset