ExperimentalGear/scripts/gameplay/track_end.lua

104 lines
2.5 KiB
Lua
Raw Normal View History

2021-10-28 12:17:20 +02:00
local bgImage = gfx.CreateSkinImage("gameplay/track_end/bg.png", 0)
local bgHexTopImage = gfx.CreateSkinImage("gameplay/track_end/top_hex.png", 0)
local bgHexBottomImage = gfx.CreateSkinImage("gameplay/track_end/bottom_hex.png", 0)
local enterFlareBlueImage = gfx.CreateSkinImage("gameplay/track_end/flares/blue_transition_flare.png", 0)
local enterFlarePinkImage = gfx.CreateSkinImage("gameplay/track_end/flares/pink_transition_flare.png", 0)
local outroTransitionScale = 0;
local outroTransitionGlobalAlpha = 0;
local outroTransitionEnterFlareX = -1920;
local tickTransitions = function (deltaTime)
if outroTransitionScale < 1 then
outroTransitionScale = outroTransitionScale + deltaTime / 3 -- transition should last for that time in seconds
else
outroTransitionScale = 1
end
outroTransitionGlobalAlpha = math.min(1, (outroTransitionScale*6))
outroTransitionEnterFlareX = math.min(2*1920, (
(outroTransitionScale-0.2)/0.1* -- Last from 0.2 transition scale for 0.1 transition scale, ending at 0.3 TS
(1920*2) -- move this amount during the transition
)-1920); -- start off-screen
end
local render = function (deltaTime)
tickTransitions(deltaTime);
gfx.GlobalAlpha(outroTransitionGlobalAlpha);
gfx.BeginPath();
gfx.ImageRect(
0,
0,
2160*0.5,
3840*0.5,
bgImage,
1,
0
);
gfx.BeginPath();
gfx.ImageRect(
0,
0,
2160*0.5,
1921*0.5,
bgHexTopImage,
1,
0
);
gfx.BeginPath();
gfx.ImageRect(
0,
1920-(1921*0.5),
2160*0.5,
1921*0.5,
bgHexBottomImage,
1,
0
);
-- Enter flares
gfx.BeginPath();
gfx.ImageRect(
outroTransitionEnterFlareX,
530,
3280*0.5,
790*0.5,
enterFlareBlueImage,
1,
0
);
gfx.BeginPath();
gfx.ImageRect(
-outroTransitionEnterFlareX, -- go from the other side of the screen
530,
3280*0.5,
790*0.5,
enterFlarePinkImage,
1,
0
);
-- Get the banner downscaled in whatever resolution it is, while maintaining the aspect ratio
-- local tw,th = gfx.ImageSize(bannerBaseImage);
-- BANNER_H = th * (1080/tw);
-- gfx.BeginPath();
-- gfx.ImageRect(
-- 0,
-- 0,
-- BANNER_W,
-- BANNER_H,
-- bannerBaseImage,
-- 1,
-- 0
-- );
end
return {
render=render
}