From 1197f9646efcd5115168bff339c519e4e7184462 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 24 Apr 2024 19:45:17 -0400 Subject: [PATCH] fix main menu -> freeplay camera positioning --- source/funkin/ui/freeplay/FreeplayState.hx | 22 +++++++++++++--------- source/funkin/ui/mainmenu/MainMenuState.hx | 14 +++++++------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 98d31a05a..44f9a9967 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -464,6 +464,15 @@ class FreeplayState extends MusicBeatSubState speed: 0.3 }); + var diffSelLeft:DifficultySelector = new DifficultySelector(20, grpDifficulties.y - 10, false, controls); + var diffSelRight:DifficultySelector = new DifficultySelector(325, grpDifficulties.y - 10, true, controls); + diffSelLeft.visible = false; + diffSelRight.visible = false; + add(diffSelLeft); + add(diffSelRight); + + // be careful not to "add()" things in here unless it's to a group that's already added to the state + // otherwise it won't be properly attatched to funnyCamera (relavent code should be at the bottom of create()) dj.onIntroDone.add(function() { // when boyfriend hits dat shiii @@ -475,12 +484,8 @@ class FreeplayState extends MusicBeatSubState FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut}); - var diffSelLeft:DifficultySelector = new DifficultySelector(20, grpDifficulties.y - 10, false, controls); - var diffSelRight:DifficultySelector = new DifficultySelector(325, grpDifficulties.y - 10, true, controls); - - add(diffSelLeft); - add(diffSelRight); - + diffSelLeft.visible = true; + diffSelRight.visible = true; letterSort.visible = true; exitMovers.set([diffSelLeft, diffSelRight], @@ -515,11 +520,10 @@ class FreeplayState extends MusicBeatSubState generateSongList(null, false); - // var swag:Alphabet = new Alphabet(1, 0, 'swag'); - + // dedicated camera for the state so we don't need to fuk around with camera scrolls from the mainmenu / elsewhere var funnyCam:FunkinCamera = new FunkinCamera('freeplayFunny', 0, 0, FlxG.width, FlxG.height); funnyCam.bgColor = FlxColor.TRANSPARENT; - FlxG.cameras.add(funnyCam); + FlxG.cameras.add(funnyCam, false); typing = new FlxInputText(100, 100); diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index 90d79ccc1..b4631d74d 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -42,7 +42,7 @@ class MainMenuState extends MusicBeatState var magenta:FlxSprite; var camFollow:FlxObject; - override function create() + override function create():Void { #if discord_rpc // Updating Discord Rich Presence @@ -170,7 +170,7 @@ class MainMenuState extends MusicBeatState }); } - function resetCamStuff() + function resetCamStuff():Void { FlxG.cameras.reset(new FunkinCamera('mainMenu')); FlxG.camera.follow(camFollow, null, 0.06); @@ -192,14 +192,14 @@ class MainMenuState extends MusicBeatState menuItems.addItem(name, item); } - override function closeSubState() + override function closeSubState():Void { magenta.visible = false; super.closeSubState(); } - override function finishTransIn() + override function finishTransIn():Void { super.finishTransIn(); @@ -271,7 +271,7 @@ class MainMenuState extends MusicBeatState } #end - public function openPrompt(prompt:Prompt, onClose:Void->Void) + public function openPrompt(prompt:Prompt, onClose:Void->Void):Void { menuItems.enabled = false; prompt.closeCallback = function() { @@ -282,7 +282,7 @@ class MainMenuState extends MusicBeatState openSubState(prompt); } - function startExitState(state:NextState) + function startExitState(state:NextState):Void { menuItems.enabled = false; // disable for exit var duration = 0.4; @@ -300,7 +300,7 @@ class MainMenuState extends MusicBeatState new FlxTimer().start(duration, function(_) FlxG.switchState(state)); } - override function update(elapsed:Float) + override function update(elapsed:Float):Void { super.update(elapsed);