Skip to content

Commit

Permalink
fixed invisible controls in custom controls menu
Browse files Browse the repository at this point in the history
  • Loading branch information
luckydog7 committed Mar 18, 2021
1 parent 0fd3ce5 commit 2fedd86
Showing 1 changed file with 47 additions and 52 deletions.
99 changes: 47 additions & 52 deletions source/options/CustomControlsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class CustomControlsState extends MusicBeatSubstate
//pad
_pad = new FlxVirtualPad(RIGHT_FULL, NONE);
_pad.alpha = 0;
_pad.visible = false;



//text inputvari
Expand All @@ -104,7 +104,6 @@ class CustomControlsState extends MusicBeatSubstate
rightArrow.animation.addByPrefix('press', "arrow push right", 24, false);
rightArrow.animation.play('idle');

changeSelection();

//text
up_text = new FlxText(200, 200, 0,"Button up x:" + _pad.buttonUp.x +" y:" + _pad.buttonUp.y, 24);
Expand Down Expand Up @@ -132,7 +131,9 @@ class CustomControlsState extends MusicBeatSubstate
add(down_text);
add(left_text);
add(right_text);


// change selection
changeSelection();
}

override function update(elapsed:Float)
Expand Down Expand Up @@ -161,61 +162,55 @@ class CustomControlsState extends MusicBeatSubstate
}

function changeSelection(change:Int = 0,?forceChange:Int)
{
curSelected += change;

if (curSelected < 0)
curSelected = controlitems.length - 1;
if (curSelected >= controlitems.length)
curSelected = 0;
trace(curSelected);

if (forceChange != null)
{
if (curSelected != 2){
curSelected += change;

if (curSelected < 0)
curSelected = controlitems.length - 1;
if (curSelected >= controlitems.length)
curSelected = 0;
trace(curSelected);

if (forceChange != null)
{
curSelected = forceChange;
}
}

inputvari.text = controlitems[curSelected];

if (forceChange != null)
{
if (curSelected == 2){
_pad.alpha = 0.75;

inputvari.text = controlitems[curSelected];

if (forceChange != null)
{
if (curSelected == 2){
_pad.visible = true;
}

return;
}

switch curSelected{
case 0:
this.remove(_pad);
_pad = null;
_pad = new FlxVirtualPad(RIGHT_FULL, NONE);
_pad.alpha = 0.75;
this.add(_pad);
case 1:
this.remove(_pad);
_pad = null;
_pad = new FlxVirtualPad(FULL, NONE);
_pad.alpha = 0.75;
this.add(_pad);
case 2:
trace(2);
_pad.alpha = 0;
case 3:
trace(3);
_pad.alpha = 0.75;
loadcustom();
}

return;
}

switch curSelected{
case 0:
this.remove(_pad);
_pad = null;
_pad = new FlxVirtualPad(RIGHT_FULL, NONE);
_pad.alpha = 0.75;
_pad.visible = true;
this.add(_pad);
case 1:
this.remove(_pad);
_pad = null;
_pad = new FlxVirtualPad(FULL, NONE);
_pad.alpha = 0.75;
_pad.visible = true;
this.add(_pad);
case 2:
trace(2);
_pad.alpha = 0;
_pad.visible = false;
case 3:
trace(3);
_pad.alpha = 0.75;
_pad.visible = true;
loadcustom();

}

}

function arrowanimate(touch:flixel.input.touch.FlxTouch){
if(touch.overlaps(leftArrow) && touch.pressed){
leftArrow.animation.play('press');
Expand Down

0 comments on commit 2fedd86

Please sign in to comment.