Skip to content

Commit

Permalink
fix preferences menu getting stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
haya3218 committed Sep 21, 2021
1 parent 23c7cc4 commit e7ed2fa
Showing 1 changed file with 35 additions and 8 deletions.
43 changes: 35 additions & 8 deletions source/gameFolder/meta/subState/charting/PreferenceSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import flixel.FlxSprite;
import flixel.math.FlxMath;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import gameFolder.meta.MusicBeat.MusicBeatSubState;

class PreferenceSubstate extends MusicBeatSubState
Expand Down Expand Up @@ -55,19 +56,45 @@ class PreferenceSubstate extends MusicBeatSubState

purpleBottomBar.cameras = [camera];
purpleTopBar.cameras = [camera];

closing = false;
}

override public function update(elapsed:Float)
{
super.update(elapsed);

blackTopBar.y = FlxMath.lerp(0, blackTopBar.y, 0.75);
blackBottomBar.y = FlxMath.lerp(FlxG.height - blackBottomBar.height, blackBottomBar.y, 0.75);
topText.y = blackTopBar.y + 15;

purpleTopBar.y = blackTopBar.y + 60;
purpleBottomBar.y = blackBottomBar.y + 9;

background.alpha = FlxMath.lerp(150 / 255, background.alpha, 0.75);
if (!closing)
{
blackTopBar.y = FlxMath.lerp(0, blackTopBar.y, 0.75);
blackBottomBar.y = FlxMath.lerp(FlxG.height - blackBottomBar.height, blackBottomBar.y, 0.75);
topText.y = blackTopBar.y + 15;

purpleTopBar.y = blackTopBar.y + 60;
purpleBottomBar.y = blackBottomBar.y + 9;

background.alpha = FlxMath.lerp(150 / 255, background.alpha, 0.75);
}
else
{
blackTopBar.y = FlxMath.lerp(-75, blackTopBar.y, 0.75);
blackBottomBar.y = FlxMath.lerp(FlxG.height, blackBottomBar.y, 0.75);
topText.y = blackTopBar.y + 15;

purpleTopBar.y = blackTopBar.y + 60;
purpleBottomBar.y = blackBottomBar.y + 9;

background.alpha = FlxMath.lerp(0, background.alpha, 0.75);
}

if (FlxG.keys.justPressed.BACKSPACE)
{
closing = true;

new FlxTimer().start(0.2, function(_)
{
close();
});
}
}
}

0 comments on commit e7ed2fa

Please sign in to comment.