diff --git a/assets/images/options/options_bg.png b/assets/images/options/options_bg.png new file mode 100644 index 0000000..85b1c6b Binary files /dev/null and b/assets/images/options/options_bg.png differ diff --git a/assets/images/title/logo.png b/assets/images/title/logo.png index b5f5ea7..acf3dc3 100644 Binary files a/assets/images/title/logo.png and b/assets/images/title/logo.png differ diff --git a/source/states/InitialState.hx b/source/states/InitialState.hx index 450eab0..6f50527 100644 --- a/source/states/InitialState.hx +++ b/source/states/InitialState.hx @@ -3,6 +3,7 @@ package states; class InitialState extends FlxState { var intro:FlxSprite; var logo:FlxSprite; + var bg:FlxSprite; override function create() { super.create(); @@ -20,6 +21,10 @@ class InitialState extends FlxState { intro.alpha = 0; add(intro); + bg = new FlxSprite().loadGraphic(Paths.image('title/title_bg')); + bg.alpha = 0; + add(bg); + logo = new FlxSprite(0, 0).loadGraphic(Paths.image('title/logo')); logo.scale.set(0.4, 0.4); logo.alpha = 0; @@ -31,8 +36,10 @@ class InitialState extends FlxState { override function update(elapsed:Float) { super.update(elapsed); + // i know this code looks bad, but it works new FlxTimer().start(3, (tmr:FlxTimer) -> { FlxTween.tween(intro, {alpha: 0}, 0.5, {ease: FlxEase.quadOut}); + FlxTween.tween(bg, {alpha: 1}, 0.5, {ease: FlxEase.quadOut}); FlxTween.tween(logo, {alpha: 1}, 0.5, {ease: FlxEase.quadOut}); new FlxTimer().start(4.5, (tmr:FlxTimer) -> { FlxTween.tween(logo, {alpha: 0}, 0.5, {ease: FlxEase.quadOut}); diff --git a/source/states/MenuState.hx b/source/states/MenuState.hx index 1219228..ab50c09 100644 --- a/source/states/MenuState.hx +++ b/source/states/MenuState.hx @@ -15,6 +15,8 @@ class MenuState extends FlxState { var grid:FlxBackdrop = new FlxBackdrop(FlxGridOverlay.createGrid(80, 80, 160, 160, true, 0x33FFFFFF, 0x0)); grid.velocity.set(40, 40); + grid.alpha = 0; + FlxTween.tween(grid, {alpha: 0.6}, 0.5, {ease: FlxEase.quadOut}); add(grid); grpSelection = new FlxTypedGroup(); @@ -46,7 +48,7 @@ class MenuState extends FlxState { case 0: FlxG.switchState(PlayState.new); case 1: - trace('options menu unfinished sorry'); + FlxG.switchState(OptionState.new); case 2: Sys.exit(0); } @@ -54,15 +56,8 @@ class MenuState extends FlxState { } function changeSelection(change:Int = 0) { - curSelected += change; - + curSelected = FlxMath.wrap(curSelected + change, 0, selections - 1); FlxG.sound.play(Paths.sound('scroll')); - - if (curSelected < 0) - curSelected = grpSelection.length - 1; - if (curSelected >= grpSelection.length) - curSelected = 0; - grpSelection.forEach((spr:FlxSprite) -> { spr.alpha = (spr.ID == curSelected) ? 1 : 0.6; }); diff --git a/source/states/OptionsState.hx b/source/states/OptionsState.hx index 0388a05..4bd3f31 100644 --- a/source/states/OptionsState.hx +++ b/source/states/OptionsState.hx @@ -9,12 +9,53 @@ class OptionState extends FlxState { "Controls", "Language" ]; + + var curSelected:Int = 0; + var camObject:FlxObject; + + var notSelectedAlpha:Float = 0.55; override function create() { super.create(); + + camObject = new FlxObject(80, 0, 0, 0); + camObject.screenCenter(X); + + var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('options/options_bg')); + add(bg); + + var grid = new FlxBackdrop(FlxGridOverlay.createGrid(80, 80, 160, 160, true, 0x2C00FF95, 0x0)); + grid.scrollFactor.set(); + grid.velocity.set(25, 25); + add(grid); + + for (i in 0...options.length) + { + var text = new FlxText(80, 40 + (60 * i), 0, options[i], 20); + text.setFormat(Paths.font('vcr.ttf'), 30, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); + text.alpha = notSelectedAlpha; + add(text); + } + + changeItem(); + + FlxG.camera.follow(camObject, LOCKON, 0.25); } override function update(elapsed:Float) { super.update(elapsed); + + if (Input.is("up") || Input.is("down")) + changeItem(Input.is("up") ? -1 : 1); + + if (Input.is("exit")) + FlxG.switchState(MenuState.new); } + + function changeItem(number:Int = 0) + { + curSelected = FlxMath.wrap(curSelected + number, 0, options - 1); + camObject.y = usersAssets[curSelected].text.y; + FlxG.sound.play(Paths.sound('scroll')); + } } \ No newline at end of file diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 25100b0..8dc7061 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -3,8 +3,13 @@ package states; class PlayState extends FlxState { var noteDirs:Array = ['left', 'down', 'up', 'right']; var strumline:FlxTypedGroup; + var notes:FlxTypedGroup; + var ratings:FlxTypedGroup; + + var score:Int = 0; var scoreTxt:FlxText; + var timeBar:Bar; override function create() { super.create(); @@ -16,7 +21,7 @@ class PlayState extends FlxState { strumline = new FlxTypedGroup(); add(strumline); - var noteWidth:Float = 200; + var noteWidth:Float = 150; var totalWidth:Float = noteDirs.length * noteWidth; var startX:Float = (FlxG.width - totalWidth) / 2; @@ -31,5 +36,30 @@ class PlayState extends FlxState { if (Input.is("exit")) FlxG.switchState(MenuState.new); + + strumline.forEach((spr:Note) -> { + switch (spr.dir) { + case "left": + if (Input.is("left", PRESSED)) + spr.press(); + else + spr.animation.play("receptor"); + case "down": + if (Input.is("down", PRESSED)) + spr.press(); + else + spr.animation.play("receptor"); + case "up": + if (Input.is("up", PRESSED)) + spr.press(); + else + spr.animation.play("receptor"); + case "right": + if (Input.is("right", PRESSED)) + spr.press(); + else + spr.animation.play("receptor"); + } + }) } } \ No newline at end of file