Skip to content

Commit

Permalink
Pause Options!
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLikesKirby committed May 22, 2024
1 parent bfd4e23 commit fe9d9c3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions source/OptionsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class OptionsMenu extends MusicBeatState
'SongName',
];
var curSongBarOptionSelected:Int;
public static var onPlayState:Bool = false;

override function create()
{
#if desktop
Expand Down Expand Up @@ -130,9 +132,17 @@ class OptionsMenu extends MusicBeatState

if (controls.BACK)
{
if(onPlayState) {
FlxG.save.flush();
CompatTool.save.flush();
LoadingState.loadAndSwitchState(new PlayState());
FlxG.sound.music.volume = 0;
onPlayState = false;
} else {
FlxG.save.flush();
CompatTool.save.flush();
FlxG.switchState(new MainMenuState());
}
}
if (controls.UP_P)
changeSelection(-1);
Expand Down
11 changes: 10 additions & 1 deletion source/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class PauseSubState extends MusicBeatSubstate
new PauseOption('Restart Song'),
new PauseOption('Change Character'),
new PauseOption('No Miss Mode'),
new PauseOption('Options'),
new PauseOption('Exit to menu')
];
var curSelected:Int = 0;
Expand Down Expand Up @@ -133,7 +134,7 @@ class PauseSubState extends MusicBeatSubstate

for (i in 0...menuItems.length)
{
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, LanguageManager.getTextString('pause_${menuItems[i].optionName}'), true, false);
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, LanguageManager.getTextString('${menuItems[i].optionName}'), true, false);
songText.isMenuItem = true;
songText.targetY = i;
grpMenuShit.add(songText);
Expand Down Expand Up @@ -241,6 +242,14 @@ class PauseSubState extends MusicBeatSubstate
PlayState.instance.health = 0;
close();
}
case "Options":
if (MathGameState.failedGame)
{
MathGameState.failedGame = false;
}
PlayState.instance.vocals.volume = 0;
FlxG.switchState(new OptionsMenu());
OptionsMenu.onPlayState = true;
case "Exit to menu":
if (MathGameState.failedGame)
{
Expand Down

0 comments on commit fe9d9c3

Please sign in to comment.