* make chain number shake only on new combo

This commit is contained in:
FajsiEx 2021-10-28 17:49:02 +02:00
parent d1694b69da
commit 2f9e66cbd5
2 changed files with 13 additions and 0 deletions

View File

@ -89,6 +89,7 @@ end
function update_combo(newCombo) function update_combo(newCombo)
chain = newCombo chain = newCombo
Chain.onNewCombo();
if (chain > maxChain) then if (chain > maxChain) then
maxChain = chain; maxChain = chain;
end end

View File

@ -6,6 +6,7 @@ local desh = 1920;
local transitionShakeScale = 0; local transitionShakeScale = 0;
local transitionShakePosOffset = 0; local transitionShakePosOffset = 0;
local shakeTimer = 0;
function load_number_image(path) function load_number_image(path)
local images = {} local images = {}
@ -57,9 +58,19 @@ local tickTransitions = function (deltaTime)
end end
end end
local onNewCombo = function ()
shakeTimer = 0.25;
end
local render = function (deltaTime, comboState, combo, critLineCenterX, critLineCenterY) local render = function (deltaTime, comboState, combo, critLineCenterX, critLineCenterY)
tickTransitions(deltaTime) tickTransitions(deltaTime)
if shakeTimer > 0 then
shakeTimer = shakeTimer - deltaTime;
else
transitionShakePosOffset = 0;
end
if combo == 0 then return end if combo == 0 then return end
local posx = desw / 2 + transitionShakePosOffset; local posx = desw / 2 + transitionShakePosOffset;
@ -86,5 +97,6 @@ local render = function (deltaTime, comboState, combo, critLineCenterX, critLine
end end
return { return {
onNewCombo=onNewCombo,
render=render render=render
} }