Fix Keybinds Menu

This commit is contained in:
lunarcleint
2023-03-23 11:11:44 -07:00
parent edf7545b56
commit efcd3af193
2 changed files with 8 additions and 10 deletions
@@ -64,8 +64,8 @@ class KeybindSetting extends FlxTypedSpriteGroup<FlxSprite> {
public override function update(elapsed:Float) {
super.update(elapsed);
bind1.alpha = (p2Selected ? 0.55 : 1) / alpha;
bind2.alpha = (p2Selected ? 1 : 0.55) / alpha;
bind1.alpha = (p2Selected ? 0.2 : 1) / alpha;
bind2.alpha = (p2Selected ? 1 : 0.2) / alpha;
bind1.alpha *= alpha;
bind2.alpha *= alpha;
}
@@ -83,7 +83,7 @@ class KeybindsOptions extends MusicBeatSubstate {
public var settingCam:FlxCamera;
public var p2Selected:Bool = false;
public var curSelected:Int = -1;
public var curSelected:Int = 0;
public var canSelect:Bool = true;
public var alphabets:FlxTypedGroup<KeybindSetting>;
public var bg:FlxSprite;
@@ -102,7 +102,6 @@ class KeybindsOptions extends MusicBeatSubstate {
super.create();
instance = this;
isSubState = FlxG.state != this;
alphabets = new FlxTypedGroup<KeybindSetting>();
bg = new FlxSprite(-80).loadAnimatedGraphic(Paths.image(isSubState ? 'menus/menuTransparent' : 'menus/menuBGBlue'));
@@ -166,8 +165,6 @@ class KeybindsOptions extends MusicBeatSubstate {
}
add(alphabets);
add(camFollow);
changeSelection(1);
}
public override function destroy() {
@@ -197,7 +194,8 @@ class KeybindsOptions extends MusicBeatSubstate {
}
if (canSelect) {
changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0));
changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0));
if (controls.BACK) {
FlxTransitionableState.skipNextTransIn = true;
if (isSubState)
@@ -235,11 +233,11 @@ class KeybindsOptions extends MusicBeatSubstate {
}
public function changeSelection(change:Int) {
if (change == 0) return;
CoolUtil.playMenuSFX(SCROLL, 0.4);
if (change != 0) CoolUtil.playMenuSFX(SCROLL, 0.4);
curSelected = FlxMath.wrap(curSelected + change, 0, alphabets.length-1);
alphabets.forEach(function(e) {
e.alpha = 0.55;
e.alpha = 0.2;
});
if (alphabets.members[curSelected] != null) {
var alphabet = alphabets.members[curSelected];