Skip to content

Commit 664c850

Browse files
committed
squ
1 parent 032248c commit 664c850

File tree

3 files changed

+44
-48
lines changed

3 files changed

+44
-48
lines changed

source/funkin/ui/charSelect/CharSelectCursors.hx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class CharSelectCursors extends FlxTypedSpriteContainer<FunkinSprite>
1818
var cursorConfirmed:FunkinSprite;
1919
var cursorDenied:FunkinSprite;
2020

21+
var cursorsIntroOutroOffset:Float = 240;
22+
2123
public function new()
2224
{
2325
super();
@@ -103,4 +105,38 @@ class CharSelectCursors extends FlxTypedSpriteContainer<FunkinSprite>
103105
cursorDenied.x = main.x - 2;
104106
cursorDenied.y = main.y - 4;
105107
}
108+
109+
public function snapToLocation(intendedPosition:FlxPoint):Void
110+
{
111+
main.setPosition(intendedPosition.x, intendedPosition.y);
112+
lightBlue.setPosition(intendedPosition.x, intendedPosition.y); // Using intendedPosition since we anyway snapping them
113+
darkBlue.setPosition(intendedPosition.x, intendedPosition.y);
114+
cursorConfirmed.setPosition(main.x - 2, main.x - 4);
115+
cursorDenied.setPosition(main.x - 2, main.x - 4);
116+
}
117+
118+
public function slide(slideIn:Bool)
119+
{
120+
if (slideIn)
121+
{
122+
main.alpha = 0;
123+
lightBlue.alpha = 0;
124+
darkBlue.alpha = 0;
125+
126+
main.y += cursorsIntroOutroOffset;
127+
lightBlue.y += cursorsIntroOutroOffset;
128+
darkBlue.y += cursorsIntroOutroOffset;
129+
130+
FlxTween.tween(main, {alpha: 1, y: main.y - cursorsIntroOutroOffset}, 0.9, {ease: FlxEase.expoOut});
131+
FlxTween.tween(lightBlue, {alpha: 1, y: lightBlue.y - cursorsIntroOutroOffset}, 0.95, {ease: FlxEase.expoOut});
132+
FlxTween.tween(darkBlue, {alpha: 1, y: darkBlue.y - cursorsIntroOutroOffset}, 1.0, {ease: FlxEase.expoOut});
133+
}
134+
else
135+
{
136+
FlxTween.tween(main, {alpha: 0, y: main.y + cursorsIntroOutroOffset}, 0.8, {ease: FlxEase.backIn});
137+
FlxTween.tween(lightBlue, {alpha: 0, y: lightBlue.y + cursorsIntroOutroOffset}, 0.82, {ease: FlxEase.backIn});
138+
FlxTween.tween(darkBlue, {alpha: 0, y: darkBlue.y + cursorsIntroOutroOffset}, 0.84, {ease: FlxEase.backIn});
139+
FlxTween.tween(cursorConfirmed, {alpha: 0, y: cursorConfirmed.y + cursorsIntroOutroOffset}, 0.8, {ease: FlxEase.expoOut});
140+
}
141+
}
106142
}

source/funkin/ui/charSelect/CharSelectSubState.hx

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -357,48 +357,14 @@ class CharSelectSubState extends MusicBeatSubState
357357
FlxTween.tween(member, {y: member.y - 300}, 1, {ease: FlxEase.expoOut});
358358
}
359359

360-
/*
361-
cursor.scrollFactor.set();
362-
cursorBlue.scrollFactor.set();
363-
cursorDarkBlue.scrollFactor.set();
364-
365-
FlxTween.color(cursor, 0.2, 0xFFFFFF00, 0xFFFFCC00, {type: PINGPONG});
366-
367-
cursorLocIntended.x = (cursorFactor * cursorX) + (FlxG.width / 2) - cursor.width / 2;
368-
cursorLocIntended.y = (cursorFactor * cursorY) + (FlxG.height / 2) - cursor.height / 2;
369-
370-
cursorLocIntended.x += cursorOffsetX;
371-
cursorLocIntended.y += cursorOffsetY;
372-
373-
cursor.x = cursorLocIntended.x;
374-
cursor.y = cursorLocIntended.y;
375-
376-
cursorBlue.x = cursor.x;
377-
cursorBlue.y = cursor.y;
378-
379-
cursorDarkBlue.x = cursorLocIntended.x;
380-
cursorDarkBlue.y = cursorLocIntended.y;
381-
382-
cursorConfirmed.x = cursor.x - 2;
383-
cursorConfirmed.y = cursor.y - 4;
384-
385-
cursorDenied.x = cursor.x - 2;
386-
cursorDenied.y = cursor.y - 4;
387-
388-
var cursorsIntroOffset:Float = 240;
389-
390-
// start invisible and slightly offset (slide up into place)
391-
cursor.alpha = 0;
392-
cursorBlue.alpha = 0;
393-
cursorDarkBlue.alpha = 0;
360+
cursorLocIntended.x = (cursorFactor * cursorX) + (FlxG.width / 2) - cursors.main.width / 2;
361+
cursorLocIntended.y = (cursorFactor * cursorY) + (FlxG.height / 2) - cursors.main.height / 2;
394362

395-
cursor.y += cursorsIntroOffset;
396-
cursorBlue.y += cursorsIntroOffset;
397-
cursorDarkBlue.y += cursorsIntroOffset;
363+
cursorLocIntended.x += cursorOffsetX;
364+
cursorLocIntended.y += cursorOffsetY;
398365

399-
FlxTween.tween(cursor, {alpha: 1, y: cursor.y - cursorsIntroOffset}, 0.9, {ease: FlxEase.expoOut});
400-
FlxTween.tween(cursorBlue, {alpha: 1, y: cursorBlue.y - cursorsIntroOffset}, 0.95, {ease: FlxEase.expoOut});
401-
FlxTween.tween(cursorDarkBlue, {alpha: 1, y: cursorDarkBlue.y - cursorsIntroOffset}, 1.0, {ease: FlxEase.expoOut}); */
366+
cursors.snapToLocation(cursorLocIntended);
367+
cursors.slide(true);
402368

403369
FlxG.debugger.addTrackerProfile(new TrackerProfile(CharSelectSubState, ["curChar", "grpXSpread", "grpYSpread"]));
404370
FlxG.debugger.track(this);
@@ -726,13 +692,7 @@ class CharSelectSubState extends MusicBeatSubState
726692
}
727693
#end
728694

729-
FlxTween.tween(cursors, {alpha: 0}, 0.8, {ease: FlxEase.expoOut});
730-
731-
/*var cursorsOutroOffset:Float = 240;
732-
FlxTween.tween(cursor, {alpha: 0, y: cursor.y + cursorsOutroOffset}, 0.8, {ease: FlxEase.backIn});
733-
FlxTween.tween(cursorBlue, {alpha: 0, y: cursorBlue.y + cursorsOutroOffset}, 0.82, {ease: FlxEase.backIn});
734-
FlxTween.tween(cursorDarkBlue, {alpha: 0, y: cursorDarkBlue.y + cursorsOutroOffset}, 0.84, {ease: FlxEase.backIn});
735-
FlxTween.tween(cursorConfirmed, {alpha: 0}, 0.8, {ease: FlxEase.expoOut}); */
695+
cursors.slide(false);
736696

737697
FlxTween.tween(barthing, {y: barthing.y + 80}, 0.8, {ease: FlxEase.backIn});
738698
FlxTween.tween(nametag, {y: nametag.y + 80}, 0.8, {ease: FlxEase.backIn});

0 commit comments

Comments
 (0)