diff --git a/Project.xml b/Project.xml index e1a9f1252..7edddb77c 100644 --- a/Project.xml +++ b/Project.xml @@ -18,7 +18,7 @@ - + diff --git a/assets/images/week54prototype.png b/assets/shared/images/week54prototype.png similarity index 100% rename from assets/images/week54prototype.png rename to assets/shared/images/week54prototype.png diff --git a/source/ControlsSubState.hx b/source/ControlsSubState.hx index d63e978e1..236d4a646 100644 --- a/source/ControlsSubState.hx +++ b/source/ControlsSubState.hx @@ -1,5 +1,6 @@ package; +import flixel.FlxSprite; import flixel.FlxSubState; class ControlsSubState extends FlxSubState @@ -7,5 +8,8 @@ class ControlsSubState extends FlxSubState public function new() { super(); + + var bullshit = new FlxSprite().makeGraphic(100, 100); + add(bullshit); } } diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 4b6a0464d..4b3a8f110 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -23,7 +23,7 @@ class MainMenuState extends MusicBeatState var menuItems:FlxTypedGroup; #if !switch - var optionShit:Array = ['story mode', 'freeplay', 'donate']; + var optionShit:Array = ['story mode', 'freeplay', 'donate', 'options']; #else var optionShit:Array = ['story mode', 'freeplay']; #end @@ -174,6 +174,8 @@ class MainMenuState extends MusicBeatState trace("Freeplay Menu Selected"); case 'options': + FlxTransitionableState.skipNextTransIn = true; + FlxTransitionableState.skipNextTransOut = true; FlxG.switchState(new OptionsMenu()); } }); diff --git a/source/Options.hx b/source/Options.hx new file mode 100644 index 000000000..f392a8b1e --- /dev/null +++ b/source/Options.hx @@ -0,0 +1,6 @@ +package; + +class Options +{ + public static var masterVolume:Float = 1; +} diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index bf36c83d5..0c5b284cc 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -32,44 +32,50 @@ class OptionsMenu extends MusicBeatState menuBG.antialiasing = true; add(menuBG); - grpControls = new FlxTypedGroup(); - add(grpControls); + /* + grpControls = new FlxTypedGroup(); + add(grpControls); - for (i in 0...controlsStrings.length) - { - if (controlsStrings[i].indexOf('set') != -1) + for (i in 0...controlsStrings.length) { - var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i].substring(3) + ': ' + controlsStrings[i + 1], true, false); - controlLabel.isMenuItem = true; - controlLabel.targetY = i; - grpControls.add(controlLabel); + if (controlsStrings[i].indexOf('set') != -1) + { + var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i].substring(3) + ': ' + controlsStrings[i + 1], true, false); + 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(); + + openSubState(new OptionsSubState()); } override function update(elapsed:Float) { super.update(elapsed); - if (controls.ACCEPT) - { - changeBinding(); - } + /* + if (controls.ACCEPT) + { + changeBinding(); + } - if (isSettingControl) - waitingInput(); - else - { - if (controls.BACK) - FlxG.switchState(new MainMenuState()); - if (controls.UP_P) - changeSelection(-1); - if (controls.DOWN_P) - changeSelection(1); - } + if (isSettingControl) + waitingInput(); + else + { + if (controls.BACK) + FlxG.switchState(new MainMenuState()); + if (controls.UP_P) + changeSelection(-1); + if (controls.DOWN_P) + changeSelection(1); + } + */ } function waitingInput():Void diff --git a/source/OptionsSubState.hx b/source/OptionsSubState.hx index 1995b868a..2b63e0c2f 100644 --- a/source/OptionsSubState.hx +++ b/source/OptionsSubState.hx @@ -1,11 +1,70 @@ package; +import flixel.FlxG; +import flixel.FlxSprite; +import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.text.FlxText; +import flixel.util.FlxColor; + class OptionsSubState extends MusicBeatSubstate { - var textMenuItems:Array = ['Master Volume', 'Sound Volume']; + var textMenuItems:Array = ['Master Volume', 'Sound Volume', 'Controls']; + + var selector:FlxSprite; + var curSelected:Int = 0; + + var grpOptionsTexts:FlxTypedGroup; public function new() { super(); + + grpOptionsTexts = new FlxTypedGroup(); + 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()); + } + } } }