fix character rotation while moving

This commit is contained in:
PeaAshMeter 2025-09-03 00:42:40 +03:00
parent 82d393a064
commit 8c1166216c

View File

@ -26,12 +26,6 @@ function logic:followPath(path)
self.mapLogic.path = path;
---@type Vec3
local nextCell = path:peek_front()
local charPos = self.mapLogic.position
if nextCell.x < charPos.x then
Tree.level.characters[self.id].graphics.animation.side = LEFT
elseif nextCell.x > charPos.x then
Tree.level.characters[self.id].graphics.animation.side = RIGHT
end
self:runTo(nextCell)
path:pop_front()
end
@ -41,6 +35,12 @@ function logic:runTo(target)
self.mapLogic.t0 = love.timer.getTime()
self.state = "run"
self.mapLogic.runTarget = target
local charPos = self.mapLogic.position
if target.x < charPos.x then
Tree.level.characters[self.id].graphics.animation.side = LEFT
elseif target.x > charPos.x then
Tree.level.characters[self.id].graphics.animation.side = RIGHT
end
end
function logic:update(dt)