options menu in progress
This commit is contained in:
parent
9ac509c72b
commit
b37f6a7614
|
@ -18,7 +18,7 @@
|
||||||
<!-- ____________________________ Window Settings ___________________________ -->
|
<!-- ____________________________ Window Settings ___________________________ -->
|
||||||
|
|
||||||
<!--These window settings apply to all targets-->
|
<!--These window settings apply to all targets-->
|
||||||
<window width="1280" height="720" fps="60" background="#000000" hardware="true" vsync="false" />
|
<window width="1280" height="720" fps="" background="#000000" hardware="true" vsync="false" />
|
||||||
|
|
||||||
<!--HTML5-specific-->
|
<!--HTML5-specific-->
|
||||||
<window if="html5" resizable="true" />
|
<window if="html5" resizable="true" />
|
||||||
|
|
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 194 KiB |
|
@ -1,5 +1,6 @@
|
||||||
package;
|
package;
|
||||||
|
|
||||||
|
import flixel.FlxSprite;
|
||||||
import flixel.FlxSubState;
|
import flixel.FlxSubState;
|
||||||
|
|
||||||
class ControlsSubState extends FlxSubState
|
class ControlsSubState extends FlxSubState
|
||||||
|
@ -7,5 +8,8 @@ class ControlsSubState extends FlxSubState
|
||||||
public function new()
|
public function new()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
var bullshit = new FlxSprite().makeGraphic(100, 100);
|
||||||
|
add(bullshit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ class MainMenuState extends MusicBeatState
|
||||||
var menuItems:FlxTypedGroup<FlxSprite>;
|
var menuItems:FlxTypedGroup<FlxSprite>;
|
||||||
|
|
||||||
#if !switch
|
#if !switch
|
||||||
var optionShit:Array<String> = ['story mode', 'freeplay', 'donate'];
|
var optionShit:Array<String> = ['story mode', 'freeplay', 'donate', 'options'];
|
||||||
#else
|
#else
|
||||||
var optionShit:Array<String> = ['story mode', 'freeplay'];
|
var optionShit:Array<String> = ['story mode', 'freeplay'];
|
||||||
#end
|
#end
|
||||||
|
@ -174,6 +174,8 @@ class MainMenuState extends MusicBeatState
|
||||||
trace("Freeplay Menu Selected");
|
trace("Freeplay Menu Selected");
|
||||||
|
|
||||||
case 'options':
|
case 'options':
|
||||||
|
FlxTransitionableState.skipNextTransIn = true;
|
||||||
|
FlxTransitionableState.skipNextTransOut = true;
|
||||||
FlxG.switchState(new OptionsMenu());
|
FlxG.switchState(new OptionsMenu());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package;
|
||||||
|
|
||||||
|
class Options
|
||||||
|
{
|
||||||
|
public static var masterVolume:Float = 1;
|
||||||
|
}
|
|
@ -32,44 +32,50 @@ class OptionsMenu extends MusicBeatState
|
||||||
menuBG.antialiasing = true;
|
menuBG.antialiasing = true;
|
||||||
add(menuBG);
|
add(menuBG);
|
||||||
|
|
||||||
grpControls = new FlxTypedGroup<Alphabet>();
|
/*
|
||||||
add(grpControls);
|
grpControls = new FlxTypedGroup<Alphabet>();
|
||||||
|
add(grpControls);
|
||||||
|
|
||||||
for (i in 0...controlsStrings.length)
|
for (i in 0...controlsStrings.length)
|
||||||
{
|
|
||||||
if (controlsStrings[i].indexOf('set') != -1)
|
|
||||||
{
|
{
|
||||||
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i].substring(3) + ': ' + controlsStrings[i + 1], true, false);
|
if (controlsStrings[i].indexOf('set') != -1)
|
||||||
controlLabel.isMenuItem = true;
|
{
|
||||||
controlLabel.targetY = i;
|
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i].substring(3) + ': ' + controlsStrings[i + 1], true, false);
|
||||||
grpControls.add(controlLabel);
|
controlLabel.isMenuItem = true;
|
||||||
|
controlLabel.targetY = i;
|
||||||
|
grpControls.add(controlLabel);
|
||||||
|
}
|
||||||
|
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
||||||
}
|
}
|
||||||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
super.create();
|
super.create();
|
||||||
|
|
||||||
|
openSubState(new OptionsSubState());
|
||||||
}
|
}
|
||||||
|
|
||||||
override function update(elapsed:Float)
|
override function update(elapsed:Float)
|
||||||
{
|
{
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
|
||||||
if (controls.ACCEPT)
|
/*
|
||||||
{
|
if (controls.ACCEPT)
|
||||||
changeBinding();
|
{
|
||||||
}
|
changeBinding();
|
||||||
|
}
|
||||||
|
|
||||||
if (isSettingControl)
|
if (isSettingControl)
|
||||||
waitingInput();
|
waitingInput();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (controls.BACK)
|
if (controls.BACK)
|
||||||
FlxG.switchState(new MainMenuState());
|
FlxG.switchState(new MainMenuState());
|
||||||
if (controls.UP_P)
|
if (controls.UP_P)
|
||||||
changeSelection(-1);
|
changeSelection(-1);
|
||||||
if (controls.DOWN_P)
|
if (controls.DOWN_P)
|
||||||
changeSelection(1);
|
changeSelection(1);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function waitingInput():Void
|
function waitingInput():Void
|
||||||
|
|
|
@ -1,11 +1,70 @@
|
||||||
package;
|
package;
|
||||||
|
|
||||||
|
import flixel.FlxG;
|
||||||
|
import flixel.FlxSprite;
|
||||||
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||||
|
import flixel.text.FlxText;
|
||||||
|
import flixel.util.FlxColor;
|
||||||
|
|
||||||
class OptionsSubState extends MusicBeatSubstate
|
class OptionsSubState extends MusicBeatSubstate
|
||||||
{
|
{
|
||||||
var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume'];
|
var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume', 'Controls'];
|
||||||
|
|
||||||
|
var selector:FlxSprite;
|
||||||
|
var curSelected:Int = 0;
|
||||||
|
|
||||||
|
var grpOptionsTexts:FlxTypedGroup<FlxText>;
|
||||||
|
|
||||||
public function new()
|
public function new()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
grpOptionsTexts = new FlxTypedGroup<FlxText>();
|
||||||
|
add(grpOptionsTexts);
|
||||||
|
|
||||||
|
selector = new FlxSprite().makeGraphic(5, 5, FlxColor.RED);
|
||||||
|
add(selector);
|
||||||
|
|
||||||
|
for (i in 0...textMenuItems.length)
|
||||||
|
{
|
||||||
|
var optionText:FlxText = new FlxText(20, 20 + (i * 50), 0, textMenuItems[i], 32);
|
||||||
|
optionText.ID = i;
|
||||||
|
grpOptionsTexts.add(optionText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override function update(elapsed:Float)
|
||||||
|
{
|
||||||
|
super.update(elapsed);
|
||||||
|
|
||||||
|
if (controls.UP_P)
|
||||||
|
curSelected -= 1;
|
||||||
|
|
||||||
|
if (controls.DOWN_P)
|
||||||
|
curSelected += 1;
|
||||||
|
|
||||||
|
if (curSelected < 0)
|
||||||
|
curSelected = textMenuItems.length - 1;
|
||||||
|
|
||||||
|
if (curSelected >= textMenuItems.length)
|
||||||
|
curSelected = 0;
|
||||||
|
|
||||||
|
grpOptionsTexts.forEach(function(txt:FlxText)
|
||||||
|
{
|
||||||
|
txt.color = FlxColor.WHITE;
|
||||||
|
|
||||||
|
if (txt.ID == curSelected)
|
||||||
|
txt.color = FlxColor.YELLOW;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (controls.ACCEPT)
|
||||||
|
{
|
||||||
|
switch (textMenuItems[curSelected])
|
||||||
|
{
|
||||||
|
case "Controls":
|
||||||
|
FlxG.state.closeSubState();
|
||||||
|
FlxG.state.openSubState(new ControlsSubState());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue