fix(cbs): add a minimal duration to moving

This commit is contained in:
Kazhnuz 2019-08-25 16:00:21 +02:00
parent 86b5ad1cae
commit 737d0e5a69

View file

@ -126,7 +126,7 @@ function Hero:getMovementDuration(dx, dy, duration)
end end
function Hero:goTo(dx, dy, timerName, duration) function Hero:goTo(dx, dy, timerName, duration)
local duration = self:getMovementDuration(dx, dy, duration) local duration = math.min(self:getMovementDuration(dx, dy, duration), 0.30)
if duration > 0 then if duration > 0 then
self.tweens:newTween(0, duration, {x = dx, y = dy}, 'inOutQuad') self.tweens:newTween(0, duration, {x = dx, y = dy}, 'inOutQuad')
end end
@ -134,7 +134,7 @@ function Hero:goTo(dx, dy, timerName, duration)
end end
function Hero:jumpTo(dx, dy, size, timerName, spinjump, duration) function Hero:jumpTo(dx, dy, size, timerName, spinjump, duration)
local duration = self:getMovementDuration(dx, dy, duration) local duration = math.min(self:getMovementDuration(dx, dy, duration), 0.30)
self.tweens:newTween(0, duration, {x = dx, y = dy}, 'inOutQuad') self.tweens:newTween(0, duration, {x = dx, y = dy}, 'inOutQuad')
self.tweens:newTimer(duration + 0.02, timerName) self.tweens:newTimer(duration + 0.02, timerName)
self:setJump(size, spinjump, duration) self:setJump(size, spinjump, duration)
@ -414,7 +414,7 @@ function Hero:chorJump(args)
xx, yy = self.choregraphy.dx, self.choregraphy.dy xx, yy = self.choregraphy.dx, self.choregraphy.dy
end end
self:jumpTo(xx, yy, 32, "action_jumpBack", false) self:jumpTo(xx, yy, 48, "action_jumpBack", false)
self:blockChoregraphy(args.blockProcess, "action_jumpBack") self:blockChoregraphy(args.blockProcess, "action_jumpBack")
end end