From d2c6a48465dd2222ed2d6dce51f154db312e24dc Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Thu, 25 Nov 2021 19:42:46 +0100 Subject: [PATCH] + landscape support to chain numbers --- scripts/gameplay/chain.lua | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/gameplay/chain.lua b/scripts/gameplay/chain.lua index ed2ffb6..a7492b4 100644 --- a/scripts/gameplay/chain.lua +++ b/scripts/gameplay/chain.lua @@ -4,6 +4,8 @@ local chainLabel = gfx.CreateSkinImage("gameplay/chain/label.png", 0) local desw = 1080; local desh = 1920; +local isLandscape = false; + local transitionShakeScale = 0; local transitionShakePosOffset = 0; local shakeTimer = 0; @@ -63,6 +65,19 @@ local onNewCombo = function () end local render = function (deltaTime, comboState, combo, critLineCenterX, critLineCenterY) + gfx.Save(); + + local resx, resy = game.GetResolution(); + isLandscape = resx > resy; + + if (isLandscape) then + desw = 1920; + desh = 1080; + else + desw = 1080; + desh = 1920; + end + tickTransitions(deltaTime) if shakeTimer > 0 then @@ -73,8 +88,13 @@ local render = function (deltaTime, comboState, combo, critLineCenterX, critLine if combo == 0 then return end + local bottomOffsetMultiplier = 0.333; + if (isLandscape) then + bottomOffsetMultiplier = 0.25 + end + local posx = desw / 2 + transitionShakePosOffset; - local posy = desh - 640 + transitionShakePosOffset; + local posy = desh - (desh*bottomOffsetMultiplier) + transitionShakePosOffset; local chainNumbers = chainNumbersReg --regular if comboState == 2 then