Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Philly Erect train sound not pausing with the game #110

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion preload/scripts/stages/phillyTrainErect.hxc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down