fix character rotation while moving
This commit is contained in:
parent
82d393a064
commit
8c1166216c
@ -26,12 +26,6 @@ function logic:followPath(path)
|
|||||||
self.mapLogic.path = path;
|
self.mapLogic.path = path;
|
||||||
---@type Vec3
|
---@type Vec3
|
||||||
local nextCell = path:peek_front()
|
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)
|
self:runTo(nextCell)
|
||||||
path:pop_front()
|
path:pop_front()
|
||||||
end
|
end
|
||||||
@ -41,6 +35,12 @@ function logic:runTo(target)
|
|||||||
self.mapLogic.t0 = love.timer.getTime()
|
self.mapLogic.t0 = love.timer.getTime()
|
||||||
self.state = "run"
|
self.state = "run"
|
||||||
self.mapLogic.runTarget = target
|
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
|
end
|
||||||
|
|
||||||
function logic:update(dt)
|
function logic:update(dt)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user