mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
freeplay exiting stuff
This commit is contained in:
parent
9403eb4957
commit
014a8f320b
2 changed files with 182 additions and 71 deletions
|
@ -70,9 +70,8 @@ class FreeplayState extends MusicBeatSubstate
|
|||
|
||||
var dj:DJBoyfriend;
|
||||
|
||||
var iconArray:Array<HealthIcon> = [];
|
||||
|
||||
var typing:FlxInputText;
|
||||
var exitMovers:Map<FlxSprite, MoveData> = new Map();
|
||||
|
||||
override function create()
|
||||
{
|
||||
|
@ -133,6 +132,14 @@ class FreeplayState extends MusicBeatSubstate
|
|||
pinkBack.color = 0xFFffd4e9; // sets it to pink!
|
||||
pinkBack.x -= pinkBack.width;
|
||||
|
||||
exitMovers.set(pinkBack,
|
||||
{
|
||||
x: -pinkBack.width,
|
||||
y: pinkBack.y,
|
||||
speed: 0.4,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
FlxTween.tween(pinkBack, {x: 0}, 0.6, {ease: FlxEase.quartOut});
|
||||
add(pinkBack);
|
||||
|
||||
|
@ -155,30 +162,84 @@ class FreeplayState extends MusicBeatSubstate
|
|||
moreWays.speed = 4;
|
||||
grpTxtScrolls.add(moreWays);
|
||||
|
||||
exitMovers.set(moreWays,
|
||||
{
|
||||
x: FlxG.width,
|
||||
y: moreWays.y,
|
||||
speed: 0.3,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
var funnyScroll:BGScrollingText = new BGScrollingText(0, 250, "BOYFRIEND", FlxG.width / 2);
|
||||
funnyScroll.funnyColor = 0xFFff9963;
|
||||
funnyScroll.speed = -1;
|
||||
grpTxtScrolls.add(funnyScroll);
|
||||
|
||||
exitMovers.set(funnyScroll,
|
||||
{
|
||||
x: -funnyScroll.width,
|
||||
y: funnyScroll.y,
|
||||
speed: 0.3,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
var txtNuts:BGScrollingText = new BGScrollingText(0, 300, "PROTECT YO NUTS", FlxG.width / 2);
|
||||
grpTxtScrolls.add(txtNuts);
|
||||
exitMovers.set(txtNuts,
|
||||
{
|
||||
x: FlxG.width,
|
||||
y: txtNuts.y,
|
||||
speed: 0.3,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
var funnyScroll2:BGScrollingText = new BGScrollingText(0, 340, "BOYFRIEND", FlxG.width / 2);
|
||||
funnyScroll2.funnyColor = 0xFFff9963;
|
||||
funnyScroll2.speed = -1.2;
|
||||
grpTxtScrolls.add(funnyScroll2);
|
||||
|
||||
exitMovers.set(funnyScroll2,
|
||||
{
|
||||
x: -funnyScroll2.width,
|
||||
y: funnyScroll2.y,
|
||||
speed: 0.3,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
var moreWays2:BGScrollingText = new BGScrollingText(0, 400, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width);
|
||||
moreWays2.funnyColor = 0xFFfff383;
|
||||
moreWays2.speed = 4.4;
|
||||
grpTxtScrolls.add(moreWays2);
|
||||
|
||||
exitMovers.set(moreWays2,
|
||||
{
|
||||
x: FlxG.width,
|
||||
y: moreWays2.y,
|
||||
speed: 0.3,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
var funnyScroll3:BGScrollingText = new BGScrollingText(0, orangeBackShit.y, "BOYFRIEND", FlxG.width / 2);
|
||||
funnyScroll3.funnyColor = 0xFFff9963;
|
||||
funnyScroll3.speed = -0.8;
|
||||
grpTxtScrolls.add(funnyScroll3);
|
||||
|
||||
exitMovers.set(funnyScroll3,
|
||||
{
|
||||
x: -funnyScroll3.width,
|
||||
y: funnyScroll3.y,
|
||||
speed: 0.3,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
dj = new DJBoyfriend(0, -100);
|
||||
exitMovers.set(dj,
|
||||
{
|
||||
x: -dj.width * 1.6,
|
||||
y: dj.y,
|
||||
speed: 0.5,
|
||||
wait: 0
|
||||
});
|
||||
add(dj);
|
||||
|
||||
var bgDad:FlxSprite = new FlxSprite(pinkBack.width * 0.75, 0).loadGraphic(Paths.image('freeplay/freeplayBGdad'));
|
||||
|
@ -187,9 +248,25 @@ class FreeplayState extends MusicBeatSubstate
|
|||
bgDad.shader = new AngleMask();
|
||||
bgDad.visible = false;
|
||||
|
||||
exitMovers.set(bgDad,
|
||||
{
|
||||
x: FlxG.width * 1.5,
|
||||
y: 0,
|
||||
speed: 0.5,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
var blackOverlayBullshitLOLXD:FlxSprite = new FlxSprite(FlxG.width).makeGraphic(Std.int(bgDad.width), Std.int(bgDad.height), FlxColor.BLACK);
|
||||
add(blackOverlayBullshitLOLXD); // used to mask the text lol!
|
||||
|
||||
exitMovers.set(blackOverlayBullshitLOLXD,
|
||||
{
|
||||
x: FlxG.width * 1.5,
|
||||
y: bgDad.height,
|
||||
speed: 0.5,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
add(bgDad);
|
||||
FlxTween.tween(blackOverlayBullshitLOLXD, {x: pinkBack.width * 0.75}, 1, {ease: FlxEase.quintOut});
|
||||
|
||||
|
@ -208,8 +285,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayNorm')));
|
||||
grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayHard')));
|
||||
|
||||
grpDifficulties.group.forEach(function(spr)
|
||||
{
|
||||
grpDifficulties.group.forEach(function(spr) {
|
||||
spr.visible = false;
|
||||
});
|
||||
|
||||
|
@ -220,9 +296,26 @@ class FreeplayState extends MusicBeatSubstate
|
|||
add(overhangStuff);
|
||||
FlxTween.tween(overhangStuff, {y: 0}, 0.3, {ease: FlxEase.quartOut});
|
||||
|
||||
exitMovers.set(overhangStuff,
|
||||
{
|
||||
y: -overhangStuff.height,
|
||||
x: 0,
|
||||
speed: 0.2,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
var fnfFreeplay:FlxText = new FlxText(0, 12, 0, "FREEPLAY", 48);
|
||||
fnfFreeplay.font = "VCR OSD Mono";
|
||||
fnfFreeplay.visible = false;
|
||||
|
||||
exitMovers.set(fnfFreeplay,
|
||||
{
|
||||
y: fnfFreeplay.y - 64,
|
||||
x: 0,
|
||||
speed: 0.2,
|
||||
wait: 0
|
||||
});
|
||||
|
||||
var sillyStroke = new StrokeShader(0xFFFFFFFF, 2, 2);
|
||||
fnfFreeplay.shader = sillyStroke;
|
||||
add(fnfFreeplay);
|
||||
|
@ -236,8 +329,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
fnfHighscoreSpr.updateHitbox();
|
||||
add(fnfHighscoreSpr);
|
||||
|
||||
new FlxTimer().start(FlxG.random.float(12, 50), function(tmr)
|
||||
{
|
||||
new FlxTimer().start(FlxG.random.float(12, 50), function(tmr) {
|
||||
fnfHighscoreSpr.animation.play("highscore");
|
||||
tmr.time = FlxG.random.float(20, 60);
|
||||
}, 0);
|
||||
|
@ -251,8 +343,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
txtCompletion.visible = false;
|
||||
add(txtCompletion);
|
||||
|
||||
dj.onIntroDone.add(function()
|
||||
{
|
||||
dj.onIntroDone.add(function() {
|
||||
FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut});
|
||||
|
||||
add(new DifficultySelector(20, grpDifficulties.y - 10, false, controls));
|
||||
|
@ -261,8 +352,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
var letterSort:LetterSort = new LetterSort(300, 100);
|
||||
add(letterSort);
|
||||
|
||||
letterSort.changeSelectionCallback = (str) ->
|
||||
{
|
||||
letterSort.changeSelectionCallback = (str) -> {
|
||||
switch (str)
|
||||
{
|
||||
case "fav":
|
||||
|
@ -274,8 +364,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
}
|
||||
};
|
||||
|
||||
new FlxTimer().start(1 / 24, function(handShit)
|
||||
{
|
||||
new FlxTimer().start(1 / 24, function(handShit) {
|
||||
fnfHighscoreSpr.visible = true;
|
||||
fnfFreeplay.visible = true;
|
||||
fp.visible = true;
|
||||
|
@ -284,8 +373,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
txtCompletion.visible = true;
|
||||
intendedCompletion = 0;
|
||||
|
||||
new FlxTimer().start(1.5 / 24, function(bold)
|
||||
{
|
||||
new FlxTimer().start(1.5 / 24, function(bold) {
|
||||
sillyStroke.width = 0;
|
||||
sillyStroke.height = 0;
|
||||
});
|
||||
|
@ -333,14 +421,12 @@ class FreeplayState extends MusicBeatSubstate
|
|||
typing = new FlxInputText(100, 100);
|
||||
add(typing);
|
||||
|
||||
typing.callback = function(txt, action)
|
||||
{
|
||||
typing.callback = function(txt, action) {
|
||||
// generateSongList(new EReg(txt.trim(), "ig"));
|
||||
trace(action);
|
||||
};
|
||||
|
||||
forEach(function(bs)
|
||||
{
|
||||
forEach(function(bs) {
|
||||
bs.cameras = [funnyCam];
|
||||
});
|
||||
|
||||
|
@ -361,15 +447,13 @@ class FreeplayState extends MusicBeatSubstate
|
|||
switch (filterStuff.filterType)
|
||||
{
|
||||
case STARTSWITH:
|
||||
tempSongs = tempSongs.filter(str ->
|
||||
{
|
||||
tempSongs = tempSongs.filter(str -> {
|
||||
return str.songName.toLowerCase().startsWith(filterStuff.filterData);
|
||||
});
|
||||
case ALL:
|
||||
// no filter!
|
||||
case FAVORITE:
|
||||
tempSongs = tempSongs.filter(str ->
|
||||
{
|
||||
tempSongs = tempSongs.filter(str -> {
|
||||
return str.isFav;
|
||||
});
|
||||
default:
|
||||
|
@ -406,20 +490,17 @@ class FreeplayState extends MusicBeatSubstate
|
|||
|
||||
var maxTimer:Float = Math.min(i, 4);
|
||||
|
||||
new FlxTimer().start((1 / 24) * maxTimer, function(doShit)
|
||||
{
|
||||
new FlxTimer().start((1 / 24) * maxTimer, function(doShit) {
|
||||
funnyMenu.doJumpIn = true;
|
||||
});
|
||||
|
||||
new FlxTimer().start((0.09 * maxTimer) + 0.85, function(lerpTmr)
|
||||
{
|
||||
new FlxTimer().start((0.09 * maxTimer) + 0.85, function(lerpTmr) {
|
||||
funnyMenu.doLerp = true;
|
||||
});
|
||||
|
||||
if (!force)
|
||||
{
|
||||
new FlxTimer().start(((0.20 * maxTimer) / (1 + maxTimer)) + 0.75, function(swagShi)
|
||||
{
|
||||
new FlxTimer().start(((0.20 * maxTimer) / (1 + maxTimer)) + 0.75, function(swagShi) {
|
||||
funnyMenu.songText.visible = true;
|
||||
funnyMenu.alpha = 1;
|
||||
});
|
||||
|
@ -439,13 +520,6 @@ class FreeplayState extends MusicBeatSubstate
|
|||
|
||||
// grpSongs.add(songText);
|
||||
|
||||
var icon:HealthIcon = new HealthIcon(tempSongs[i].songCharacter);
|
||||
// icon.sprTracker = songText;
|
||||
|
||||
// using a FlxGroup is too much fuss!
|
||||
iconArray.push(icon);
|
||||
// add(icon);
|
||||
|
||||
// songText.x += 40;
|
||||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
||||
// songText.screenCenter(X);
|
||||
|
@ -500,8 +574,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
FlxTween.tween(grpCapsules.members[realShit], {angle: 360}, 0.4,
|
||||
{
|
||||
ease: FlxEase.elasticOut,
|
||||
onComplete: _ ->
|
||||
{
|
||||
onComplete: _ -> {
|
||||
grpCapsules.members[realShit].favIcon.visible = true;
|
||||
grpCapsules.members[realShit].favIcon.animation.play("fav");
|
||||
}
|
||||
|
@ -510,12 +583,10 @@ class FreeplayState extends MusicBeatSubstate
|
|||
else
|
||||
{
|
||||
grpCapsules.members[realShit].favIcon.animation.play('fav', false, true);
|
||||
new FlxTimer().start((1 / 24) * 14, _ ->
|
||||
{
|
||||
new FlxTimer().start((1 / 24) * 14, _ -> {
|
||||
grpCapsules.members[realShit].favIcon.visible = false;
|
||||
});
|
||||
new FlxTimer().start((1 / 24) * 24, _ ->
|
||||
{
|
||||
new FlxTimer().start((1 / 24) * 24, _ -> {
|
||||
FlxTween.tween(grpCapsules.members[realShit], {angle: 0}, 0.4, {ease: FlxEase.elasticOut});
|
||||
});
|
||||
}
|
||||
|
@ -537,7 +608,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
fp.updateScore(Std.int(lerpScore));
|
||||
|
||||
txtCompletion.text = Math.floor(lerpCompletion * 100) + "%";
|
||||
trace(Highscore.getCompletion(songs[curSelected].songName, curDifficulty));
|
||||
// trace(Highscore.getCompletion(songs[curSelected].songName, curDifficulty));
|
||||
|
||||
// trace(intendedScore);
|
||||
// trace(lerpScore);
|
||||
|
@ -565,7 +636,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
|
||||
FlxG.watch.addQuick("LENGTH", length);
|
||||
FlxG.watch.addQuick("ANGLE", Math.round(FlxAngle.asDegrees(angle)));
|
||||
trace("ANGLE", Math.round(FlxAngle.asDegrees(angle)));
|
||||
// trace("ANGLE", Math.round(FlxAngle.asDegrees(angle)));
|
||||
}
|
||||
|
||||
/* switch (inputID)
|
||||
|
@ -684,9 +755,30 @@ class FreeplayState extends MusicBeatSubstate
|
|||
{
|
||||
FlxG.sound.play(Paths.sound('cancelMenu'));
|
||||
|
||||
FlxTransitionableState.skipNextTransIn = true;
|
||||
FlxTransitionableState.skipNextTransOut = true;
|
||||
FlxG.switchState(new MainMenuState());
|
||||
// FlxTween.tween(dj, {x: -dj.width}, 0.2, {ease: FlxEase.quartOut});
|
||||
|
||||
var longestTimer:Float = 0;
|
||||
|
||||
for (spr in exitMovers.keys())
|
||||
{
|
||||
var moveData:MoveData = exitMovers.get(spr);
|
||||
FlxTween.tween(spr, {x: moveData.x, y: moveData.y}, moveData.speed, {ease: FlxEase.expoIn});
|
||||
|
||||
longestTimer = Math.max(longestTimer, moveData.speed + moveData.wait);
|
||||
}
|
||||
|
||||
for (caps in grpCapsules.members)
|
||||
{
|
||||
caps.doJumpIn = false;
|
||||
caps.doLerp = false;
|
||||
caps.doJumpOut = true;
|
||||
}
|
||||
|
||||
new FlxTimer().start(longestTimer, (_) -> {
|
||||
FlxTransitionableState.skipNextTransIn = true;
|
||||
FlxTransitionableState.skipNextTransOut = true;
|
||||
FlxG.switchState(new MainMenuState());
|
||||
});
|
||||
}
|
||||
|
||||
if (accepted)
|
||||
|
@ -724,14 +816,13 @@ class FreeplayState extends MusicBeatSubstate
|
|||
SongLoad.curDiff = PlayState.storyDifficulty_NEW;
|
||||
|
||||
PlayState.storyWeek = songs[curSelected].week;
|
||||
trace(' CUR WEEK ' + PlayState.storyWeek);
|
||||
// trace(' CUR WEEK ' + PlayState.storyWeek);
|
||||
|
||||
// Visual and audio effects.
|
||||
FlxG.sound.play(Paths.sound('confirmMenu'));
|
||||
dj.confirm();
|
||||
|
||||
new FlxTimer().start(1, function(tmr:FlxTimer)
|
||||
{
|
||||
new FlxTimer().start(1, function(tmr:FlxTimer) {
|
||||
LoadingState.loadAndSwitchState(new PlayState(), true);
|
||||
});
|
||||
}
|
||||
|
@ -769,8 +860,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
'normal';
|
||||
};
|
||||
|
||||
grpDifficulties.group.forEach(function(spr)
|
||||
{
|
||||
grpDifficulties.group.forEach(function(spr) {
|
||||
spr.visible = false;
|
||||
});
|
||||
|
||||
|
@ -779,8 +869,7 @@ class FreeplayState extends MusicBeatSubstate
|
|||
curShit.visible = true;
|
||||
curShit.offset.y += 5;
|
||||
curShit.alpha = 0.5;
|
||||
new FlxTimer().start(1 / 24, function(swag)
|
||||
{
|
||||
new FlxTimer().start(1 / 24, function(swag) {
|
||||
curShit.alpha = 1;
|
||||
curShit.updateHitbox();
|
||||
});
|
||||
|
@ -826,13 +915,6 @@ class FreeplayState extends MusicBeatSubstate
|
|||
|
||||
var bullShit:Int = 0;
|
||||
|
||||
for (i in 0...iconArray.length)
|
||||
{
|
||||
iconArray[i].alpha = 0.6;
|
||||
}
|
||||
|
||||
iconArray[curSelected].alpha = 1;
|
||||
|
||||
for (index => capsule in grpCapsules.members)
|
||||
{
|
||||
capsule.selected = false;
|
||||
|
@ -884,8 +966,7 @@ class DifficultySelector extends FlxSprite
|
|||
|
||||
whiteShader.colorSet = true;
|
||||
|
||||
new FlxTimer().start(2 / 24, function(tmr)
|
||||
{
|
||||
new FlxTimer().start(2 / 24, function(tmr) {
|
||||
whiteShader.colorSet = false;
|
||||
updateHitbox();
|
||||
});
|
||||
|
@ -920,3 +1001,11 @@ class SongMetadata
|
|||
this.isFav = isFav;
|
||||
}
|
||||
}
|
||||
|
||||
typedef MoveData =
|
||||
{
|
||||
var x:Float;
|
||||
var y:Float;
|
||||
var speed:Float;
|
||||
var wait:Float;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
public var doLerp:Bool = false;
|
||||
public var doJumpIn:Bool = false;
|
||||
|
||||
public var doJumpOut:Bool = false;
|
||||
|
||||
public function new(x:Float, y:Float, song:String)
|
||||
{
|
||||
super(x, y);
|
||||
|
@ -52,27 +54,47 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
selected = selected; // just to kickstart the set_selected
|
||||
}
|
||||
|
||||
var frameTicker:Float = 0;
|
||||
var frameTypeBeat:Int = 0;
|
||||
var frameInTicker:Float = 0;
|
||||
var frameInTypeBeat:Int = 0;
|
||||
|
||||
var frameOutTicker:Float = 0;
|
||||
var frameOutTypeBeat:Int = 0;
|
||||
|
||||
var xFrames:Array<Float> = [1.7, 1.8, 0.85, 0.85, 0.97, 0.97, 1];
|
||||
var xPosLerpLol:Array<Float> = [0.9, 0.4, 0.16, 0.16, 0.22, 0.22, 0.245]; // NUMBERS ARE JANK CUZ THE SCALING OR WHATEVER
|
||||
var xPosOutLerpLol:Array<Float> = [0.245, 0.75, 0.98, 0.98, 1.2]; // NUMBERS ARE JANK CUZ THE SCALING OR WHATEVER
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
if (doJumpIn)
|
||||
{
|
||||
frameTicker += elapsed;
|
||||
frameInTicker += elapsed;
|
||||
|
||||
if (frameTicker >= 1 / 24 && frameTypeBeat < xFrames.length)
|
||||
if (frameInTicker >= 1 / 24 && frameInTypeBeat < xFrames.length)
|
||||
{
|
||||
frameTicker = 0;
|
||||
frameInTicker = 0;
|
||||
|
||||
scale.x = xFrames[frameTypeBeat];
|
||||
scale.y = 1 / xFrames[frameTypeBeat];
|
||||
x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameTypeBeat, xPosLerpLol.length - 1))];
|
||||
scale.x = xFrames[frameInTypeBeat];
|
||||
scale.y = 1 / xFrames[frameInTypeBeat];
|
||||
x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameInTypeBeat, xPosLerpLol.length - 1))];
|
||||
|
||||
frameTypeBeat += 1;
|
||||
frameInTypeBeat += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (doJumpOut)
|
||||
{
|
||||
frameOutTicker += elapsed;
|
||||
|
||||
if (frameOutTicker >= 1 / 24 && frameOutTypeBeat < xFrames.length)
|
||||
{
|
||||
frameOutTicker = 0;
|
||||
|
||||
scale.x = xFrames[frameOutTypeBeat];
|
||||
scale.y = 1 / xFrames[frameOutTypeBeat];
|
||||
x = FlxG.width * xPosOutLerpLol[Std.int(Math.min(frameOutTypeBeat, xPosOutLerpLol.length - 1))];
|
||||
|
||||
frameOutTypeBeat += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue