1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-04 13:54:22 +00:00

lil polish stuff!

This commit is contained in:
Cameron Taylor 2023-03-16 00:55:25 -04:00
parent 4a6b961046
commit 91724133d7
2 changed files with 33 additions and 14 deletions

View file

@ -797,6 +797,12 @@ class FreeplayState extends MusicBeatSubstate
caps.doJumpOut = true;
}
if (Type.getClass(FlxG.state) == MainMenuState)
{
FlxG.state.persistentUpdate = true;
FlxG.state.persistentDraw = true;
}
new FlxTimer().start(longestTimer, (_) -> {
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;

View file

@ -88,8 +88,7 @@ class MainMenuState extends MusicBeatState
menuItems = new MenuTypedList<AtlasMenuItem>();
add(menuItems);
menuItems.onChange.add(onMenuItemChange);
menuItems.onAcceptPress.add(function(_)
{
menuItems.onAcceptPress.add(function(_) {
if (_.name == 'freeplay')
{
magenta.visible = true;
@ -102,8 +101,7 @@ class MainMenuState extends MusicBeatState
menuItems.enabled = true; // can move on intro
createMenuItem('storymode', 'mainmenu/storymode', function() startExitState(new StoryMenuState()));
createMenuItem('freeplay', 'mainmenu/freeplay', function()
{
createMenuItem('freeplay', 'mainmenu/freeplay', function() {
persistentDraw = true;
persistentUpdate = false;
openSubState(new FreeplayState());
@ -114,8 +112,7 @@ class MainMenuState extends MusicBeatState
createMenuItem('donate', 'mainmenu/donate', selectDonate, hasPopupBlocker);
#end
createMenuItem('options', 'mainmenu/options', function()
{
createMenuItem('options', 'mainmenu/options', function() {
startExitState(new OptionsState());
});
@ -129,8 +126,21 @@ class MainMenuState extends MusicBeatState
menuItem.y = top + spacing * i;
}
FlxG.cameras.reset(new SwagCamera());
FlxG.camera.follow(camFollow, null, 0.06);
resetCamStuff();
subStateClosed.add(_ -> {
resetCamStuff();
});
subStateOpened.add(sub -> {
if (Type.getClass(sub) == FreeplayState)
{
new FlxTimer().start(0.5, _ -> {
magenta.visible = false;
});
}
});
// FlxG.camera.setScrollBounds(bg.x, bg.x + bg.width, bg.y, bg.y + bg.height * 1.2);
super.create();
@ -142,6 +152,12 @@ class MainMenuState extends MusicBeatState
// NG.core.calls.event.logEvent('swag').send();
}
function resetCamStuff()
{
FlxG.cameras.reset(new SwagCamera());
FlxG.camera.follow(camFollow, null, 0.06);
}
function createMenuItem(name:String, atlas:String, callback:Void->Void, fireInstantly:Bool = false):Void
{
var item = new AtlasMenuItem(name, Paths.getSparrowAtlas(atlas), callback);
@ -214,8 +230,7 @@ class MainMenuState extends MusicBeatState
var onPromptClose = checkLoginStatus;
if (onClose != null)
{
onPromptClose = function()
{
onPromptClose = function() {
checkLoginStatus();
onClose();
}
@ -235,8 +250,7 @@ class MainMenuState extends MusicBeatState
public function openPrompt(prompt:Prompt, onClose:Void->Void)
{
menuItems.enabled = false;
prompt.closeCallback = function()
{
prompt.closeCallback = function() {
menuItems.enabled = true;
if (onClose != null) onClose();
}
@ -248,8 +262,7 @@ class MainMenuState extends MusicBeatState
{
menuItems.enabled = false; // disable for exit
var duration = 0.4;
menuItems.forEach(function(item)
{
menuItems.forEach(function(item) {
if (menuItems.selectedIndex != item.ID)
{
FlxTween.tween(item, {alpha: 0}, duration, {ease: FlxEase.quadOut});