Merge pull request #511 from FunkinCrew/freeplay/cam-move

fix main menu -> freeplay camera positioning
This commit is contained in:
Cameron Taylor 2024-04-25 05:55:57 -04:00 committed by GitHub
commit 85350013d7
2 changed files with 20 additions and 16 deletions

View file

@ -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);

View file

@ -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);