diff --git a/scripts/gameplay.lua b/scripts/gameplay.lua index 2faad81..76155bd 100644 --- a/scripts/gameplay.lua +++ b/scripts/gameplay.lua @@ -89,6 +89,7 @@ end function update_combo(newCombo) chain = newCombo + Chain.onNewCombo(); if (chain > maxChain) then maxChain = chain; end diff --git a/scripts/gameplay/chain.lua b/scripts/gameplay/chain.lua index b608ef8..af34414 100644 --- a/scripts/gameplay/chain.lua +++ b/scripts/gameplay/chain.lua @@ -6,6 +6,7 @@ local desh = 1920; local transitionShakeScale = 0; local transitionShakePosOffset = 0; +local shakeTimer = 0; function load_number_image(path) local images = {} @@ -57,9 +58,19 @@ local tickTransitions = function (deltaTime) end end +local onNewCombo = function () + shakeTimer = 0.25; +end + local render = function (deltaTime, comboState, combo, critLineCenterX, critLineCenterY) tickTransitions(deltaTime) + if shakeTimer > 0 then + shakeTimer = shakeTimer - deltaTime; + else + transitionShakePosOffset = 0; + end + if combo == 0 then return end local posx = desw / 2 + transitionShakePosOffset; @@ -86,5 +97,6 @@ local render = function (deltaTime, comboState, combo, critLineCenterX, critLine end return { + onNewCombo=onNewCombo, render=render } \ No newline at end of file