+ better way of stopping the results music

This commit is contained in:
FajsiEx 2021-11-20 22:43:11 +01:00
parent d61f63b665
commit 85cad9562c
4 changed files with 20 additions and 2 deletions

13
scripts/common/common.lua Normal file
View File

@ -0,0 +1,13 @@
local stopMusic = function ()
local musicPlaying = game.GetSkinSetting('_musicPlaying');
if musicPlaying and musicPlaying ~= '' then
game.StopSample(musicPlaying);
game.SetSkinSetting("_musicPlaying", "")
end
end
return {
stopMusic = stopMusic
}

View File

@ -1,5 +1,7 @@
json = require "json" json = require "json"
local common = require('common.common');
local resX,resY = game.GetResolution() local resX,resY = game.GetResolution()
local mposx = 0; local mposx = 0;
@ -742,6 +744,7 @@ render = function(deltaTime)
mposx,mposy = game.GetMousePos(); mposx,mposy = game.GetMousePos();
portrait = resY > resX portrait = resY > resX
common.stopMusic();
doffset = doffset * 0.9 doffset = doffset * 0.9
ioffset = ioffset * 0.9 ioffset = ioffset * 0.9

View File

@ -169,9 +169,8 @@ local handleSfx = function()
if not bgSfxPlayed then if not bgSfxPlayed then
game.PlaySample("result", true) game.PlaySample("result", true)
bgSfxPlayed = true bgSfxPlayed = true
game.SetSkinSetting('_musicPlaying', 'result');
end end
if game.GetButton(game.BUTTON_STA) then game.StopSample("result") end
if game.GetButton(game.BUTTON_BCK) then game.StopSample("result") end
end end
function drawTimingBar(y, value, max, type) function drawTimingBar(y, value, max, type)

View File

@ -1,6 +1,7 @@
require('common') require('common')
local Easing = require('common.easings') local Easing = require('common.easings')
local Background = require('components.background'); local Background = require('components.background');
local common = require('common.common')
local VolforceCalc = require('components.volforceCalc'); local VolforceCalc = require('components.volforceCalc');
@ -749,6 +750,8 @@ render = function (deltaTime)
tickTransitions(deltaTime); tickTransitions(deltaTime);
gfx.Scale(scale, scale); gfx.Scale(scale, scale);
common.stopMusic();
if not difficultyNumbers then if not difficultyNumbers then
difficultyNumbers = load_number_image('diff_num') difficultyNumbers = load_number_image('diff_num')
end end