From e55faf6c6a1a06bba8e10e829fc5ad3fbfacfcb4 Mon Sep 17 00:00:00 2001 From: Hyper_ Date: Mon, 27 Jan 2025 22:00:53 -0300 Subject: [PATCH] fix: Philly Train Erect not pausing the train sound --- preload/scripts/stages/phillyTrainErect.hxc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/preload/scripts/stages/phillyTrainErect.hxc b/preload/scripts/stages/phillyTrainErect.hxc index 7b2ace93c..6c71e6212 100644 --- a/preload/scripts/stages/phillyTrainErect.hxc +++ b/preload/scripts/stages/phillyTrainErect.hxc @@ -307,7 +307,7 @@ class PhillyTrainErectStage extends Stage // NOTE: You pass the constructor variables directly, not as an array. lightShader = ScriptedFlxRuntimeShader.init('BuildingEffectShader', 1.0); - trainSound = new FlxSound().loadEmbedded(Paths.sound('train_passes')); + trainSound = FunkinSound.load(Paths.sound('train_passes')); colorShader = new AdjustColorShader(); FlxG.sound.list.add(trainSound); @@ -418,6 +418,20 @@ class PhillyTrainErectStage extends Stage } } + public override function onPause(event:PauseScriptEvent) { + super.onPause(event); + + // Temporarily stop ambiance. + if (trainSound != null) trainSound.pause(); + } + + public override function onResume(event:ScriptEvent) { + super.onResume(event); + + // Resume temporarily stopped ambiance. + if (trainSound != null) trainSound.resume(); + } + function trainStart():Void { trainMoving = true;