From 20c4822064cb2878b819cca527bc9885895bdae2 Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Thu, 28 Oct 2021 12:17:20 +0200 Subject: [PATCH] + start with track end transition --- scripts/gameplay.lua | 8 +- scripts/gameplay/track_end.lua | 104 ++++++++++++++++++ .../filter.png => gameplay/track_end/bg.png} | Bin .../{ => gameplay}/track_end/bottom_hex.png | Bin .../flares/blue_transition_flare.png | Bin .../track_end/flares/green_dot_1.png | Bin .../track_end/flares/green_dot_2.png | Bin .../flares/pink_transition_flare.png | Bin .../track_end/flares/red_flare_ring.png | Bin .../track_end/flares/red_glow_ball.png | Bin .../track_end/particles/blue_ring.png | Bin .../particles/large_rainbow_ring.png | Bin .../particles/small_rainbow_ring.png | Bin .../particles/small_yellow_ring_1.png | Bin .../particles/small_yellow_ring_2.png | Bin .../particles/small_yellow_ring_3.png | Bin .../particles/small_yellow_ring_4.png | Bin .../track_end/particles/yellow_ring.png | Bin textures/{ => gameplay}/track_end/top_hex.png | Bin .../{ => gameplay}/track_end/track_comp.png | Bin .../track_end/track_comp_blur.png | Bin 21 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 scripts/gameplay/track_end.lua rename textures/{track_end/filter.png => gameplay/track_end/bg.png} (100%) rename textures/{ => gameplay}/track_end/bottom_hex.png (100%) rename textures/{ => gameplay}/track_end/flares/blue_transition_flare.png (100%) rename textures/{ => gameplay}/track_end/flares/green_dot_1.png (100%) rename textures/{ => gameplay}/track_end/flares/green_dot_2.png (100%) rename textures/{ => gameplay}/track_end/flares/pink_transition_flare.png (100%) rename textures/{ => gameplay}/track_end/flares/red_flare_ring.png (100%) rename textures/{ => gameplay}/track_end/flares/red_glow_ball.png (100%) rename textures/{ => gameplay}/track_end/particles/blue_ring.png (100%) rename textures/{ => gameplay}/track_end/particles/large_rainbow_ring.png (100%) rename textures/{ => gameplay}/track_end/particles/small_rainbow_ring.png (100%) rename textures/{ => gameplay}/track_end/particles/small_yellow_ring_1.png (100%) rename textures/{ => gameplay}/track_end/particles/small_yellow_ring_2.png (100%) rename textures/{ => gameplay}/track_end/particles/small_yellow_ring_3.png (100%) rename textures/{ => gameplay}/track_end/particles/small_yellow_ring_4.png (100%) rename textures/{ => gameplay}/track_end/particles/yellow_ring.png (100%) rename textures/{ => gameplay}/track_end/top_hex.png (100%) rename textures/{ => gameplay}/track_end/track_comp.png (100%) rename textures/{ => gameplay}/track_end/track_comp_blur.png (100%) diff --git a/scripts/gameplay.lua b/scripts/gameplay.lua index 9b24993..eadba40 100644 --- a/scripts/gameplay.lua +++ b/scripts/gameplay.lua @@ -11,6 +11,8 @@ local Gauge = require('gameplay.gauge') local Chain = require('gameplay.chain') local LaserAlert = require('gameplay.laser_alert') +local TrackEnd = require('gameplay.track_end') + local resx, resy = game.GetResolution() local desw, desh; local scale; @@ -60,8 +62,12 @@ function render_intro(deltaTime) return true end +local outroTimer = 0; function render_outro(deltaTime, clearState) - return true, 1 + TrackEnd.render(deltaTime); + + outroTimer = outroTimer + deltaTime + return outroTimer > 10, 1 - outroTimer end function update_score(newScore) diff --git a/scripts/gameplay/track_end.lua b/scripts/gameplay/track_end.lua new file mode 100644 index 0000000..a7d1c21 --- /dev/null +++ b/scripts/gameplay/track_end.lua @@ -0,0 +1,104 @@ + +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 +} \ No newline at end of file diff --git a/textures/track_end/filter.png b/textures/gameplay/track_end/bg.png similarity index 100% rename from textures/track_end/filter.png rename to textures/gameplay/track_end/bg.png diff --git a/textures/track_end/bottom_hex.png b/textures/gameplay/track_end/bottom_hex.png similarity index 100% rename from textures/track_end/bottom_hex.png rename to textures/gameplay/track_end/bottom_hex.png diff --git a/textures/track_end/flares/blue_transition_flare.png b/textures/gameplay/track_end/flares/blue_transition_flare.png similarity index 100% rename from textures/track_end/flares/blue_transition_flare.png rename to textures/gameplay/track_end/flares/blue_transition_flare.png diff --git a/textures/track_end/flares/green_dot_1.png b/textures/gameplay/track_end/flares/green_dot_1.png similarity index 100% rename from textures/track_end/flares/green_dot_1.png rename to textures/gameplay/track_end/flares/green_dot_1.png diff --git a/textures/track_end/flares/green_dot_2.png b/textures/gameplay/track_end/flares/green_dot_2.png similarity index 100% rename from textures/track_end/flares/green_dot_2.png rename to textures/gameplay/track_end/flares/green_dot_2.png diff --git a/textures/track_end/flares/pink_transition_flare.png b/textures/gameplay/track_end/flares/pink_transition_flare.png similarity index 100% rename from textures/track_end/flares/pink_transition_flare.png rename to textures/gameplay/track_end/flares/pink_transition_flare.png diff --git a/textures/track_end/flares/red_flare_ring.png b/textures/gameplay/track_end/flares/red_flare_ring.png similarity index 100% rename from textures/track_end/flares/red_flare_ring.png rename to textures/gameplay/track_end/flares/red_flare_ring.png diff --git a/textures/track_end/flares/red_glow_ball.png b/textures/gameplay/track_end/flares/red_glow_ball.png similarity index 100% rename from textures/track_end/flares/red_glow_ball.png rename to textures/gameplay/track_end/flares/red_glow_ball.png diff --git a/textures/track_end/particles/blue_ring.png b/textures/gameplay/track_end/particles/blue_ring.png similarity index 100% rename from textures/track_end/particles/blue_ring.png rename to textures/gameplay/track_end/particles/blue_ring.png diff --git a/textures/track_end/particles/large_rainbow_ring.png b/textures/gameplay/track_end/particles/large_rainbow_ring.png similarity index 100% rename from textures/track_end/particles/large_rainbow_ring.png rename to textures/gameplay/track_end/particles/large_rainbow_ring.png diff --git a/textures/track_end/particles/small_rainbow_ring.png b/textures/gameplay/track_end/particles/small_rainbow_ring.png similarity index 100% rename from textures/track_end/particles/small_rainbow_ring.png rename to textures/gameplay/track_end/particles/small_rainbow_ring.png diff --git a/textures/track_end/particles/small_yellow_ring_1.png b/textures/gameplay/track_end/particles/small_yellow_ring_1.png similarity index 100% rename from textures/track_end/particles/small_yellow_ring_1.png rename to textures/gameplay/track_end/particles/small_yellow_ring_1.png diff --git a/textures/track_end/particles/small_yellow_ring_2.png b/textures/gameplay/track_end/particles/small_yellow_ring_2.png similarity index 100% rename from textures/track_end/particles/small_yellow_ring_2.png rename to textures/gameplay/track_end/particles/small_yellow_ring_2.png diff --git a/textures/track_end/particles/small_yellow_ring_3.png b/textures/gameplay/track_end/particles/small_yellow_ring_3.png similarity index 100% rename from textures/track_end/particles/small_yellow_ring_3.png rename to textures/gameplay/track_end/particles/small_yellow_ring_3.png diff --git a/textures/track_end/particles/small_yellow_ring_4.png b/textures/gameplay/track_end/particles/small_yellow_ring_4.png similarity index 100% rename from textures/track_end/particles/small_yellow_ring_4.png rename to textures/gameplay/track_end/particles/small_yellow_ring_4.png diff --git a/textures/track_end/particles/yellow_ring.png b/textures/gameplay/track_end/particles/yellow_ring.png similarity index 100% rename from textures/track_end/particles/yellow_ring.png rename to textures/gameplay/track_end/particles/yellow_ring.png diff --git a/textures/track_end/top_hex.png b/textures/gameplay/track_end/top_hex.png similarity index 100% rename from textures/track_end/top_hex.png rename to textures/gameplay/track_end/top_hex.png diff --git a/textures/track_end/track_comp.png b/textures/gameplay/track_end/track_comp.png similarity index 100% rename from textures/track_end/track_comp.png rename to textures/gameplay/track_end/track_comp.png diff --git a/textures/track_end/track_comp_blur.png b/textures/gameplay/track_end/track_comp_blur.png similarity index 100% rename from textures/track_end/track_comp_blur.png rename to textures/gameplay/track_end/track_comp_blur.png