+ flash exc gauge when below 30 percent

This commit is contained in:
FajsiEx 2021-07-26 19:26:49 +02:00
parent c4b099da94
commit 1442883ee5
1 changed files with 14 additions and 1 deletions

View File

@ -696,6 +696,7 @@ end
-- draw_gauge: --
local gaugeNumBack = gfx.CreateSkinImage("gauge_num_back.png", 0)
local gaugeWarnTransitionScale = 0;
local gaugeEffBgImage = gfx.CreateSkinImage("gameplay/gauges/effective/gauge_back.png", 0)
local gaugeEffFailFillImage = gfx.CreateSkinImage("gameplay/gauges/effective/gauge_fill_fail.png", 0)
@ -710,6 +711,7 @@ local gaugeExcArsFillImage = gfx.CreateSkinImage("gameplay/gauges/excessive_ars/
function draw_gauge(deltaTime)
-- fallbacks in case of unsupported type
local gaugeFillAlpha = 1;
local gaugeBgImage = gaugeEffBgImage;
local gaugeFillImage = gaugeEffPassFillImage;
@ -725,6 +727,15 @@ function draw_gauge(deltaTime)
elseif gameplay.gauge.type == 1 then
gaugeBgImage = gaugeExcBgImage;
gaugeFillImage = gaugeExcFillImage;
if gameplay.gauge.value < 0.3 then
gaugeFillAlpha = 1 - math.abs(gaugeWarnTransitionScale - 0.5); -- 100 -> 50 -> 100
gaugeWarnTransitionScale = gaugeWarnTransitionScale + deltaTime*10;
if gaugeWarnTransitionScale > 1 then
gaugeWarnTransitionScale = 0;
end
end
end
@ -736,8 +747,10 @@ function draw_gauge(deltaTime)
-- gfx.Text('RESX: ' .. resx .. ' // RESY: ' .. resy .. ' // GPX: ' .. gaugePosX, 255,1200);
gfx.ImageRect(gaugePosX, gaugePosY, BgW, BgH, gaugeBgImage, 1, 0)
gfx.ImageRect(gaugePosX+22, gaugePosY+11+(FillH-(FillH*(gameplay.gauge.value))), FillW, FillH*(gameplay.gauge.value), gaugeFillImage, 1, 0)
gfx.GlobalAlpha(gaugeFillAlpha);
gfx.ImageRect(gaugePosX+22, gaugePosY+11+(FillH-(FillH*(gameplay.gauge.value))), FillW, FillH*(gameplay.gauge.value), gaugeFillImage, 1, 0)
gfx.GlobalAlpha(1);
-- TODO: Draw gauge % label