From 2f9e66cbd5262a998a4d4fcc0a1654436d7b458a Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Thu, 28 Oct 2021 17:49:02 +0200 Subject: [PATCH] * make chain number shake only on new combo --- scripts/gameplay.lua | 1 + scripts/gameplay/chain.lua | 12 ++++++++++++ 2 files changed, 13 insertions(+) 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