diff --git a/Project.xml b/Project.xml index b40d81b5c..4536d8c09 100644 --- a/Project.xml +++ b/Project.xml @@ -94,5 +94,5 @@ - + diff --git a/source/ChartingState.hx b/source/ChartingState.hx index a4cf96c92..3ebeb10f9 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -18,6 +18,7 @@ import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup; import flixel.math.FlxMath; import flixel.math.FlxPoint; +import flixel.system.FlxSound; import flixel.text.FlxText; import flixel.ui.FlxButton; import flixel.ui.FlxSpriteButton; @@ -71,6 +72,8 @@ class ChartingState extends MusicBeatState var tempBpm:Int = 0; + var vocals:FlxSound; + override function create() { gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16); @@ -276,12 +279,24 @@ class ChartingState extends MusicBeatState function loadSong(daSong:String):Void { if (FlxG.sound.music != null) + { FlxG.sound.music.stop(); + // vocals.stop(); + } + + FlxG.sound.playMusic('assets/music/' + daSong + "_Inst" + TitleState.soundExt, 0.6); + + // WONT WORK FOR TUTORIAL! REDO LATER + vocals = new FlxSound().loadEmbedded("assets/music/" + daSong + "_Voices" + TitleState.soundExt); + FlxG.sound.list.add(vocals); - FlxG.sound.playMusic('assets/music/' + daSong + TitleState.soundExt, 0.6); FlxG.sound.music.pause(); + vocals.pause(); + FlxG.sound.music.onComplete = function() { + vocals.pause(); + vocals.time = 0; FlxG.sound.music.pause(); FlxG.sound.music.time = 0; }; @@ -430,6 +445,7 @@ class ChartingState extends MusicBeatState { PlayState.SONG = _song; FlxG.sound.music.stop(); + vocals.stop(); FlxG.switchState(new PlayState()); } @@ -440,9 +456,13 @@ class ChartingState extends MusicBeatState if (FlxG.sound.music.playing) { FlxG.sound.music.pause(); + vocals.pause(); } else + { + vocals.play(); FlxG.sound.music.play(); + } } if (FlxG.keys.justPressed.R) @@ -456,6 +476,7 @@ class ChartingState extends MusicBeatState if (FlxG.keys.pressed.W || FlxG.keys.pressed.S) { FlxG.sound.music.pause(); + vocals.pause(); var daTime:Float = 700 * FlxG.elapsed; @@ -465,6 +486,8 @@ class ChartingState extends MusicBeatState } else FlxG.sound.music.time += daTime; + + vocals.time = FlxG.sound.music.time; } } @@ -497,6 +520,7 @@ class ChartingState extends MusicBeatState if (updateMusic) { FlxG.sound.music.pause(); + vocals.pause(); var daNum:Int = 0; var daLength:Int = 0; @@ -507,6 +531,7 @@ class ChartingState extends MusicBeatState } FlxG.sound.music.time = (daLength - (_song.notes[sec].lengthInSteps)) * Conductor.stepCrochet; + vocals.time = FlxG.sound.music.time; updateCurStep(); } diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx new file mode 100644 index 000000000..6a772421b --- /dev/null +++ b/source/MainMenuState.hx @@ -0,0 +1,148 @@ +package; + +import flixel.FlxG; +import flixel.FlxObject; +import flixel.FlxSprite; +import flixel.effects.FlxFlicker; +import flixel.graphics.frames.FlxAtlasFrames; +import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.tweens.FlxEase; +import flixel.tweens.FlxTween; + +class MainMenuState extends MusicBeatState +{ + var curSelected:Int = 0; + + var menuItems:FlxTypedGroup; + + var optionShit:Array = ['story mode', 'freeplay', 'donate']; + + var magenta:FlxSprite; + var camFollow:FlxObject; + + override function create() + { + persistentUpdate = persistentDraw = true; + + var bg:FlxSprite = new FlxSprite(-80).loadGraphic(AssetPaths.menuBG__png); + bg.scrollFactor.x = 0; + bg.scrollFactor.y = 0.18; + bg.setGraphicSize(Std.int(bg.width * 1.1)); + bg.updateHitbox(); + bg.screenCenter(); + bg.antialiasing = true; + add(bg); + + camFollow = new FlxObject(0, 0, 1, 1); + add(camFollow); + + magenta = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, 0xFFF44688); + magenta.visible = false; + add(magenta); + magenta.scrollFactor.set(); + + menuItems = new FlxTypedGroup(); + add(menuItems); + + var tex = FlxAtlasFrames.fromSparrow(AssetPaths.FNF_main_menu_assets__png, AssetPaths.FNF_main_menu_assets__xml); + + for (i in 0...optionShit.length) + { + var menuItem:FlxSprite = new FlxSprite(0, 60 + (i * 160)); + menuItem.frames = tex; + menuItem.animation.addByPrefix('idle', optionShit[i] + " basic", 24); + menuItem.animation.addByPrefix('selected', optionShit[i] + " white", 24); + menuItem.animation.play('idle'); + menuItem.ID = i; + menuItem.screenCenter(X); + menuItems.add(menuItem); + menuItem.scrollFactor.set(); + menuItem.antialiasing = true; + } + + FlxG.camera.follow(camFollow, null, 0.06); + + changeItem(); + + super.create(); + } + + override function update(elapsed:Float) + { + if (controls.UP_P) + changeItem(-1); + if (controls.DOWN_P) + changeItem(1); + + super.update(elapsed); + + if (controls.ACCEPT) + { + if (optionShit[curSelected] == 'donate') + { + FlxG.openURL('https://ninja-muffin24.itch.io/funkin'); + } + else + { + FlxFlicker.flicker(magenta, 0, 0.40); + + menuItems.forEach(function(spr:FlxSprite) + { + if (curSelected != spr.ID) + { + FlxTween.tween(spr, {alpha: 0}, 0.4, { + ease: FlxEase.quadOut, + onComplete: function(twn:FlxTween) + { + spr.kill(); + } + }); + } + else + { + FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker) + { + var daChoice:String = optionShit[curSelected]; + + switch (daChoice) + { + case 'story mode': + FlxG.switchState(new StoryMenuState()); + case 'freeplay': + FlxG.switchState(new FreeplayState()); + } + }); + } + }); + } + } + + menuItems.forEach(function(spr:FlxSprite) + { + spr.screenCenter(X); + }); + } + + function changeItem(huh:Int = 0) + { + curSelected += huh; + + if (curSelected >= menuItems.length) + curSelected = 0; + if (curSelected < 0) + curSelected = menuItems.length - 1; + + menuItems.forEach(function(spr:FlxSprite) + { + spr.animation.play('idle'); + + if (spr.ID == curSelected) + { + spr.animation.play('selected'); + camFollow.setPosition(spr.getGraphicMidpoint().x, spr.getGraphicMidpoint().y); + } + + spr.updateHitbox(); + }); + } +} diff --git a/source/PlayState.hx b/source/PlayState.hx index 89d997a94..8f08c4fa3 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -728,6 +728,8 @@ class PlayState extends MusicBeatState if (storyPlaylist.length <= 0) { FlxG.switchState(new TitleState()); + + StoryMenuState.weekUnlocked[1] = true; } else { diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 20a635eab..a42c20562 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -15,7 +15,9 @@ class StoryMenuState extends MusicBeatState var scoreText:FlxText; var weekData:Array = [['Tutorial', 'Bopeebo', 'Fresh', 'Dadbattle'], ['Spookeez', 'South', 'Monster']]; - var weekUnlocked:Array = [true, false]; + + public static var weekUnlocked:Array = [true, false]; + var weekCharacters:Array = [['dad', 'bf', 'gf'], ['spooky', 'bf', 'gf']]; var curWeek:Int = 0; diff --git a/source/TitleState.hx b/source/TitleState.hx index 4a48ba94d..3b4cdd3d0 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -28,6 +28,14 @@ class TitleState extends MusicBeatState var credTextShit:Alphabet; var textGroup:FlxGroup; + var wackyIntros:Array> = [ + ['Shoutouts to tom fulp', 'lmao'], ["Ludum dare", "extraordinaire"], ['Cyberzone', 'coming soon'], ['love to thriftman', 'swag'], + ['ULTIMATE RHYTHM GAMING', 'probably'], ['DOPE ASS GAME', 'playstation magazine'], ['in loving memory of', 'henryeyes'], ['dancin', 'forever'], + ['Ritz dx', 'rest in peace'], ['rate five', 'do not blam'], ['rhythm gaming', 'ultimate'], ['game of the year', 'forever'], + ['you already know', 'we really out here'], ['rise and grind', 'love to luis'], ['like parappa', 'but cooler']]; + + var curWacky:Array = []; + override public function create():Void { #if (!web) @@ -36,12 +44,14 @@ class TitleState extends MusicBeatState PlayerSettings.init(); + curWacky = FlxG.random.getObject(wackyIntros); + // DEBUG BULLSHIT super.create(); #if SKIP_TO_PLAYSTATE - FlxG.switchState(new FreeplayState()); + FlxG.switchState(new MainMenuState()); #else startIntro(); #end @@ -55,9 +65,9 @@ class TitleState extends MusicBeatState diamond.persist = true; diamond.destroyOnNoUse = false; - FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 2, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32}, + FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 1, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32}, new FlxRect(0, 0, FlxG.width, FlxG.height)); - FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 1.3, new FlxPoint(0, 1), + FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1), {asset: diamond, width: 32, height: 32}, new FlxRect(0, 0, FlxG.width, FlxG.height)); initialized = true; @@ -108,7 +118,7 @@ class TitleState extends MusicBeatState // credGroup.add(credTextShit); - FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt, 0, false); + FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt, 0); FlxG.sound.music.fadeIn(4, 0, 0.7); } @@ -139,13 +149,13 @@ class TitleState extends MusicBeatState FlxG.camera.flash(FlxColor.WHITE, 1); transitioning = true; - FlxG.sound.music.stop(); + // FlxG.sound.music.stop(); new FlxTimer().start(2, function(tmr:FlxTimer) { - FlxG.switchState(new StoryMenuState()); + FlxG.switchState(new MainMenuState()); }); - FlxG.sound.play('assets/music/titleShoot' + TitleState.soundExt, 0.7); + // FlxG.sound.play('assets/music/titleShoot' + TitleState.soundExt, 0.7); } super.update(elapsed); @@ -213,10 +223,10 @@ class TitleState extends MusicBeatState // credTextShit.text = 'Shoutouts Tom Fulp'; // credTextShit.screenCenter(); case 9: - createCoolText(['Shoutouts Tom Fulp']); + createCoolText([curWacky[0]]); // credTextShit.visible = true; case 11: - addMoreText('lmao'); + addMoreText(curWacky[1]); // credTextShit.text += '\nlmao'; case 12: deleteCoolText();