From 2cf4559a81a14caba4bb1890ddb89dcd13c9c749 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 22 Mar 2021 21:04:55 +0100 Subject: [PATCH] feat: add turning animation --- sonic-radiance.love/scenes/overworld/actors/gizmo.lua | 1 + sonic-radiance.love/scenes/overworld/charsetmanager.lua | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/sonic-radiance.love/scenes/overworld/actors/gizmo.lua b/sonic-radiance.love/scenes/overworld/actors/gizmo.lua index de5a069..207017b 100644 --- a/sonic-radiance.love/scenes/overworld/actors/gizmo.lua +++ b/sonic-radiance.love/scenes/overworld/actors/gizmo.lua @@ -40,6 +40,7 @@ function Gizmo:applyProperties() self.charset = self.properties.charset or nil self.charDir = self.properties.charDir or "down" self.cantTurn = self.properties.cantTurn or self.cantTurn + self.isTurning = (self.properties.isTurning == true) if (self.properties.event ~= nil) then local data = require("datas.gamedata.events." .. self.properties.event) self.event = data.actions diff --git a/sonic-radiance.love/scenes/overworld/charsetmanager.lua b/sonic-radiance.love/scenes/overworld/charsetmanager.lua index d963dde..df1c82f 100644 --- a/sonic-radiance.love/scenes/overworld/charsetmanager.lua +++ b/sonic-radiance.love/scenes/overworld/charsetmanager.lua @@ -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) 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