From 4ccb0556729423deb25db34709546bb0ea4ea79c Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Tue, 31 Aug 2021 19:13:17 +0200 Subject: [PATCH] feat: add overlay darkening --- sonic-radiance.love/game/modules/gui/overlay.lua | 14 +++++++------- sonic-radiance.love/game/scenes/init.lua | 7 ++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/sonic-radiance.love/game/modules/gui/overlay.lua b/sonic-radiance.love/game/modules/gui/overlay.lua index ae18c4c..7cca4c5 100644 --- a/sonic-radiance.love/game/modules/gui/overlay.lua +++ b/sonic-radiance.love/game/modules/gui/overlay.lua @@ -21,15 +21,15 @@ local animateDisappear = { {"upBorder", "movement", 0.0, 0.5, 0, 0, "inOutQuart"}, {"downBorder", "movement", 0.0, 0.5, 424, 240, "inOutQuart"}, {"version", "movement", 0.0, 0.5, 380, 250, "inOutQuart"}, - {"overlayDarken", "tween", 0.0, 0.4, {opacity = 0}, "outExpo"} + {"overlayDarken", "tween", 0.0, 0.6, {opacity = 0}, "outExpo"} } local showBackground = { - {"overlayDarken", "tween", 0.0, 0.4, {opacity = OVERLAY_OPACITY}, "inExpo"} + {"overlayDarken", "tween", 0.0, 0.6, {opacity = OVERLAY_OPACITY}, "inExpo"} } local hideBackground = { - {"overlayDarken", "tween", 0.0, 0.4, {opacity = 0}, "outExpo"} + {"overlayDarken", "tween", 0.0, 0.6, {opacity = 0}, "outExpo"} } local showVersion = { @@ -86,10 +86,10 @@ function OverlayScreen:createElements() local d = either(wasActive, 30, 0) local v = either(hadVersion, 30, 0) return { - {TextureElement("upBorder", self.borders, 0, d, 0, 1, -1, 0, 0, 1, -1), 0}, - {TextureElement("downBorder", self.borders, 424, 240 - d, 0, -1, 1, 0, 0, 1, -1), 0}, - {ColorElement("overlayDarken", 0, 0, 0, 0), 0}, - {TextElement("version", "small", "v" .. game.version, 380, 250 - v, "left", -1), 0} + {TextureElement("upBorder", self.borders, 0, d, 0, 1, -1, 0, 0, 1), 0, -1}, + {TextureElement("downBorder", self.borders, 424, 240 - d, 0, -1, 1, 0, 0, 1), 0, -1}, + {ColorElement("overlayDarken", 0, 0, 0, 0), 0, 5}, + {TextElement("version", "small", "v" .. game.version, 380, 250 - v, "left"), 0, -1} } end diff --git a/sonic-radiance.love/game/scenes/init.lua b/sonic-radiance.love/game/scenes/init.lua index 050a2f9..c40517f 100644 --- a/sonic-radiance.love/game/scenes/init.lua +++ b/sonic-radiance.love/game/scenes/init.lua @@ -2,6 +2,7 @@ local BirbScene = require "birb.modules.scenes" local RadianceScene = BirbScene:extend() local Overlay = require "game.modules.gui.overlay" +local MessageQueue = require "game.modules.messagequeue" function RadianceScene:new(haveBorder, showVersion) RadianceScene.super.new(self) @@ -16,14 +17,18 @@ function RadianceScene:new(haveBorder, showVersion) self.gui:addSFX("error", "mError") Overlay(haveBorder, showVersion) + MessageQueue(self) end function RadianceScene:hideOverlay() self.gui:hideScreen("overlay") end -function RadianceScene:showOverlay() +function RadianceScene:showOverlay(darken) self.gui:showScreen("overlay") + if (darken) then + self.gui:playScreenTransform("overlay", "showBackground") + end end