1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-12 07:07:18 +00:00

fix the camera not panning when opening then closing the debug menu during transition

This commit is contained in:
Cameron Taylor 2024-06-24 23:43:34 -04:00
parent 39c3af58f2
commit 5751430261

View file

@ -153,6 +153,9 @@ class MainMenuState extends MusicBeatState
resetCamStuff(); resetCamStuff();
// reset camera when debug menu is closed
subStateClosed.add(_ -> resetCamStuff(false));
subStateOpened.add(sub -> { subStateOpened.add(sub -> {
if (Type.getClass(sub) == FreeplayState) if (Type.getClass(sub) == FreeplayState)
{ {
@ -182,10 +185,11 @@ class MainMenuState extends MusicBeatState
}); });
} }
function resetCamStuff():Void function resetCamStuff(?snap:Bool = true):Void
{ {
FlxG.camera.follow(camFollow, null, 0.06); FlxG.camera.follow(camFollow, null, 0.06);
FlxG.camera.snapToTarget();
if (snap) FlxG.camera.snapToTarget();
} }
function createMenuItem(name:String, atlas:String, callback:Void->Void, fireInstantly:Bool = false):Void function createMenuItem(name:String, atlas:String, callback:Void->Void, fireInstantly:Bool = false):Void
@ -344,8 +348,6 @@ class MainMenuState extends MusicBeatState
persistentUpdate = false; persistentUpdate = false;
FlxG.state.openSubState(new DebugMenuSubState()); FlxG.state.openSubState(new DebugMenuSubState());
// reset camera when debug menu is closed
subStateClosed.addOnce(_ -> resetCamStuff());
} }
#end #end