Skip to content

Commit 1fe0b58

Browse files
committed
options are now scrolled
1 parent e31f3a2 commit 1fe0b58

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

source/options/OptionsState.hx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,19 @@ class OptionsState extends MusicBeatState
6969

7070
for (num => option in options)
7171
{
72-
var optionText:Alphabet = new Alphabet(0, 0, Language.getPhrase('options_$option', option), true);
73-
optionText.screenCenter();
74-
optionText.y += (92 * (num - (options.length / 2))) + 45;
72+
var optionText:Alphabet = new Alphabet(-300, 350, Language.getPhrase('options_$option', option), true);
73+
optionText.isMenuItem = true;
74+
optionText.targetY = num;
75+
optionText.ID = num;
76+
//optionText.y += (92 * (num - (options.length / 2))) + 45;
7577
grpOptions.add(optionText);
7678
}
7779

7880
selectorLeft = new Alphabet(0, 0, '>', true);
7981
//add(selectorLeft);
8082
selectorRight = new Alphabet(0, 0, '<', true);
81-
add(selectorRight);
83+
//selectorRight.scrollFactor.set();
84+
//add(selectorRight);
8285

8386
changeSelection();
8487
ClientPrefs.saveSettings();
@@ -118,6 +121,18 @@ class OptionsState extends MusicBeatState
118121
else MusicBeatState.switchState(new MainMenuState());
119122
}
120123
else if (controls.ACCEPT) openSelectedSubstate(options[curSelected]);
124+
125+
for(item in grpOptions.members)
126+
{
127+
var coolEffect:Int = 0;
128+
129+
if(item.ID < curSelected)
130+
coolEffect = ((item.ID - curSelected) * 90);
131+
else if (item.ID > curSelected)
132+
coolEffect = -((item.ID - curSelected) * 90);
133+
134+
item.x = FlxMath.lerp(item.ID == curSelected? 380 : -2010 + coolEffect, item.x, CoolUtil.boundTo(1 - (elapsed * 9), 0, 1));
135+
}
121136
}
122137

123138
override function beatHit()
@@ -142,10 +157,6 @@ class OptionsState extends MusicBeatState
142157
if (item.targetY == 0)
143158
{
144159
item.alpha = 1;
145-
selectorLeft.x = item.x - 63;
146-
selectorLeft.y = item.y;
147-
selectorRight.x = item.x + item.width + 15;
148-
selectorRight.y = item.y;
149160
}
150161
}
151162
FlxG.sound.play(Paths.sound('scrollMenu'));

0 commit comments

Comments
 (0)